Description Usage Arguments Value Author(s) Examples
A box or violin plot with significance test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ggbox(obj, factorNames, ...)
## S4 method for signature 'data.frame'
ggbox(
obj,
sampleda,
factorNames,
indexNames,
geom = "boxplot",
factorLevels = NULL,
compare = TRUE,
testmethod = "wilcox.test",
signifmap = FALSE,
p_textsize = 2,
step_increase = 0.1,
boxwidth = 0.2,
facetnrow = 1,
controlgroup = NULL,
comparelist = NULL,
...
)
## S4 method for signature 'alphasample'
ggbox(obj, factorNames, ...)
|
obj |
object, alphasample or data.frame (row sample x column features). |
factorNames |
character, the names of factor contained in sampleda. |
... |
additional arguments, see also |
sampleda |
data.frame, sample information if obj is data.frame, the sampleda should be provided. |
indexNames |
character, the vector character, should be the names of features contained object. |
geom |
character, "boxplot" or "violin", default is "boxplot". |
factorLevels |
list, the levels of the factors, default is NULL, if you want to order the levels of factor, you can set this. |
compare |
logical, whether test the features among groups,default is TRUE. |
testmethod |
character, the method of test, default is 'wilcox.test'.
see also |
signifmap |
logical, whether the pvalue are directly written a annotaion
or asterisks are used instead, default is (pvalue) FALSE. see also
|
p_textsize |
numeric, the size of text of pvalue or asterisks, default is 2. |
step_increase |
numeric, see also |
boxwidth |
numeric, the width of boxplot when the geom is 'violin', default is 0.2. |
facetnrow |
integer, the nrow of facet, default is 1. |
controlgroup |
character, the names of control group, if it was set, the other groups will compare to it, default is NULL. |
comparelist |
list, the list of vector, default is NULL. |
a 'ggplot' plot object, a box or violine plot.
Shuangbin Xu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | library(magrittr)
otudafile <- system.file("extdata", "otu_tax_table.txt",
package="MicrobiotaProcess")
otuda <- read.table(otudafile, sep="\t",
header=TRUE, row.names=1,
check.names=FALSE, skip=1,
comment.char="")
samplefile <- system.file("extdata",
"sample_info.txt",
package="MicrobiotaProcess")
sampleda <- read.table(samplefile,
sep="\t", header=TRUE, row.names=1)
otuda <- otuda[sapply(otuda, is.numeric)] %>% t() %>%
data.frame(check.names=FALSE)
set.seed(1024)
alphaobj1 <- get_alphaindex(otuda, sampleda=sampleda)
p1 <- ggbox(alphaobj1, factorNames="group")
data(test_otu_data)
set.seed(1024)
alphaobj2 <- get_alphaindex(test_otu_data)
class(alphaobj2)
head(as.data.frame(alphaobj2))
p2 <- ggbox(alphaobj2, factorNames="group")
# set factor levels.
#p3 <- ggbox(obj=alphaobj2, factorNames="group",
# factorLevels=list(group=c("M", "N", "B", "D")))
# set control group.
#p4 <- ggbox(obj=alphaobj2, factorNames="group", controlgroup="B")
# set comparelist
#p5 <- ggbox(obj=alphaobj2, factorNames="group",
# comparelist=list(c("B", "D"), c("B", "M"), c("B", "N")))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.