View source: R/summary-insertions.R
SummaryStat-class | R Documentation |
Just like subtotals()
s, summary statistics can
be inserted into cubes. SummaryStat()
makes an object of type SummaryStat
which can be added on to a CrunchCube's insertions
to add the specified
summary statistic. Currently only mean
and median
are supported; both
use weighted algorithms to go from counts and numeric values of
categories to the expected statistic. Although SummaryStat
objects can be
made by hand, it is recommended instead to use the addSummaryStat()
function which is much quicker and easier to simply add a summary
statistic to an existing CrunchCube.
SummaryStat(
name,
stat,
categories = NULL,
position = c("relative", "top", "bottom"),
after = NULL,
before = NULL,
includeNA = FALSE
)
SummaryStat(
name,
stat,
categories = NULL,
position = c("relative", "top", "bottom"),
after = NULL,
before = NULL,
includeNA = FALSE
)
is.SummaryStat(x)
are.SummaryStats(x)
name |
character the name of the summary statistic |
stat |
a function to calculate the summary (e.g. |
categories |
character or numeric the category names or ids to be included in the summary statistic, if empty all categories |
position |
character one of "relative", "top", or "bottom". Determines the position of the subtotal or heading, either at the top, bottom, or relative to another category in the cube (default) |
after |
character or numeric if |
before |
character or numeric if |
includeNA |
should missing categories be included in the summary? |
x |
for |
Summary statistics are intended only for CrunchCube objects, and are not able to be set on Crunch variables.
noTransforms()
is useful if you don't want to see or use any transformations like
Subtotals and Headings. This action only applies to the CrunchCube object in
R: it doesn't actually change the variables on Crunch servers or the query
that generated the CrunchCube.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.