facetSpacing | R Documentation |
facetSpacing
generates a vector for the at=
specification in functions for data sub-grouping
facetSpacing(subgroup, labels)
subgroup |
positive integer; number of levels in the subgrouping factor |
labels |
positive integer; number of levels in the primary factor |
facetSpacing
takes the number factor levels from the primary and secodary grouping factors to generate a vector of positions for plotting subgrouped data for the nicePlots package.
The spacing assumes that each primary factor levels is plot on positive integers 1, 2, 3 etc.
For a primary factor at position i
with f
subgroup levels, the subgrouping comes from generating equally spaced intervals starting at i-\frac{1}{2}+\frac{1}{f+1}
and ending at i+\frac{1}{2}-\frac{1}{f+1}
. Simply put:
Spacing = \frac{1}{NSubGroups-1}
a numeric vector of where to plot the subgrouped data. Can be supplied to that at=
option in plotting functions
prepCategoryWindow
#\donttest{boxplot(CNA$BM~ CNA$Status,border="white")}
#\donttest{stripchart(CNA$BM~factor(paste0(CNA$Status,CNA$Sex)),add=T,at=facetSpacing(2,2))}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.