Months=sample(6:30,12,replace=TRUE),Stage=sample(1:4,12,replace=TRUE),Continued=sample(0:1,12,replace=TRUE))df<-df|>group_by(Patient)|>mutate('Complete Response Start'=sample(c(6:(max(Months)-1),NA),1,prob=c(rep
x="year", y="value", group="group", method="tufte", min.space=0.05) { ## First rename the columns for consistency ids <- match(c(x, y, group), names(df)) df <- df[,ids] names(df) <- c("x", "y", "group") ## Expand grid to ensure every combination has a defined v...
#scale_y_continuous(labels = scales::comma) + # Optional, format y-axis labels
Three groups by x position Simple plots # Box plots bxp <- ggboxplot( df, x = "supp", y = "len", fill = "dose", palette = "npg" ) bxp # Bar plots bp <- ggbarplot( df, x = "supp", y = "len", fill = "dose", palette = "npg", add = "mean_sd", positio...
#stacked barplot """ product year export percentage sum copper 2006 4176 79 5255 copper 2007 8560 81 10505 copper 2008 6473 76 8519 copper 2009 10465 80 13027 copper 2010 14977 86 17325 copper 2011 15421 83 18629 copper 2012 14805 82 18079 copper 2013 15183 80 19088 copper...
tufte_sort <- function(df, x="year", y="value", group="group", method="tufte", min....