Description Usage Arguments Value Author(s) See Also Examples
View source: R/aveytoolkit_ggSmartBoxplot.R
Boxplot wrapper for ggplot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
x |
the variable to group by for boxplots |
mat |
data.frame or matrix of values to plot with samples in columns |
splitRowBy |
a factor used to split the data by row in facet_grid |
splitColBy |
a factor used to split the data by col in facet_grid |
colorBy |
a factor used for coloring. No coloring will be done if |
rows |
row names or row indices of the items to be plotted |
cols |
substring to search for with "grep" in column names to be plotted |
whichCols |
the column indices or full column names |
sep |
a separator used in searching for cols in the column names |
outlier.shape |
shape of outliers (default is 17, filled triangle) |
ylab |
if NULL, default is to use rownames. Can specify a string instead to use |
space |
If |
scales |
Are scales shared across all facets (the default, |
fileName |
|
plot |
logical specifying whether or not to plot the plot(s). Default is TRUE. |
... |
other arguments that are passed to qplot |
filename |
the name of a file to write a PDF to or |
invisibly returns a list with 2 elements: ggplot: the ggplot object to be plotted (this can be added to dat: a named list of the data frame(s) passed to data in ggplot. The names come from converting the rows argument to a character vector.
Stefan Avey
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 | data(OrchardSprays)
## Example of functionality
ggSmartBoxplot(x=OrchardSprays$treatment,
mat=t(OrchardSprays[,1]),
rows=1, whichCols=1:ncol(t(OrchardSprays)),
colorBy=factor(OrchardSprays$rowpos+OrchardSprays$colpos > 9),
xlab="Treatment")
## Not run:
cellType <- "PBMC"
## expr would be an expression matrix with genes in rows and samples in columns
geneSub <- grep("HLA-A29.1", rownames(expr))
age <- "Young"
ages <- c("Young", "Old")
responses <- c("NR", "R")
subset <- targetFClist[[cellType]]$Age %in% ages &
targetFClist[[cellType]]$Response %in% responses
ggSmartBoxplot(x=targetFClist[[cellType]][subset, "Time"],
mat=exprFClist[[cellType]], ylim=c(-1,1),
rows=geneSub, whichCols=which(subset),
colorBy=targetFClist[[cellType]][subset,"Response"],
splitRowBy=targetFClist[[cellType]][subset,"Age"],
xlab="Days (Post Vaccination)",
fileName=NA)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.