ggfactorial | R Documentation |
This functions returns the ggplot object
ggfactorial(dat, column, y, x, reps, ycols, xcols, func, facet, type)
dat |
data frame, matrix, or vector; if 'dat' is a data frame or matrix, vector and missing 'func', return boxplot objects only. |
column |
column number |
y |
atomic vector; groups of experiment. e.g. c("setA","setA","setA","setB","setB","setB"). y_fctr is a first factor and its levels are same or less than x_fctr as second factor. |
x |
atomic vector; groups of experiment. e.g. c(1,2,3,1,2,3), |
reps |
groups of replicate experiment(optional) |
ycols |
colors corresponding to levels of y_fctr |
xcols |
colors corresponding to levels of x_fctr |
func |
calcurate statistics for margin 1 of 'dat'. (optional) |
facet |
logical; if TRUE, additional ggplot objects using facet_wrap are created. if 'type' is 'all', could not adding facet_wrap. |
type |
type of ggplot select from "point", "segment", "line", and "all". The default value is "point". |
List containing ggplot objects
# # sample dat ## Not run: dat1 <- rskodat::dat1 dat2 <- rskodat::dat2 dat1norep <- rskodat::dat1norep dat2norep <- rskodat::dat2norep # data.frame input res1 <- ggfactorial(dat = dat1, column = -1:-4, y = strains, x = days, facet = TRUE, func = mean, type = "point") do.call(gridExtra::grid.arrange, c(res1, list(ncol = 2))) # single column data.frame input res2 <- ggfactorial(dat = dat2, column = -1:-4, y = strains, x = days, reps = reps, type = "line") do.call(gridExtra::grid.arrange, c(res2, list(ncol = 2))) # single column data.frame input res3 <- ggfactorial(dat = dat2norep, column =5, y=strains, x = days, type = "segment") do.call(gridExtra::grid.arrange, c(res3, list(ncol = 2))) # data.frame input and manual colour setting col2 <- c(1,2); col3 <- c(1,2,4) res4 <- ggfactorial(dat = dat1, column=-1:-4, y = strains, x = days, ycols = col2, xcols = col3, facet = TRUE, func = mean, type = "point") do.call(gridExtra::grid.arrange, c(res4, list(ncol = 2))) # type is 'all' res5 <- ggfactorial(dat = dat1, column =-1:-4, y = strains, x = days, reps = reps, fun = mean, type = "all") do.call(gridExtra::grid.arrange, c(res5, list(ncol = 2))) # none replicate factor, and function is none res6 <- ggfactorial(dat = dat1norep, column=-1:-4, y = strains, x_fctr = days, type = "none") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.