TwoGroups | R Documentation |
This function describes a numeric variable by a grouping factor with two levels. First, a descriptive text listing the frequencies and means of the two groups and the results of the significance test is generated. The results of Desc(x~g)
are reported as they are provided by the function, followed by a plot consisting of a density plot and a box plot.
This description makes sense, for example, if the age distribution of a collective is to be represented for both sexes.
TwoGroups(x, ..., plotit = TRUE)
## Default S3 method:
TwoGroups(x, g, main = NULL, vname = NULL, ..., plotit = TRUE)
## S3 method for class 'formula'
TwoGroups(formula, data, subset, na.action, ...)
## S3 method for class 'TwoGroups'
ToWrd(x, font = NULL, ..., wrd = DescToolsOptions("lastWord"))
x |
the numeric variable to describe. |
g |
the grouping factor (preferably with two levels.) |
main |
the main title. |
vname |
the variable names used in the description text. |
plotit |
boolean. Should a plot be created? Default can be defined by |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see |
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when the data contain NAs. Defaults to |
font |
the first font will be chosen for the introducing text, when sending the output to Word, the second for the description. |
wrd |
the pointer to a running MS Word instance, as created by GetNewWrd() (for a new one) or by GetCurrWrd() for an existing one. Default is |
... |
the dots are sent to the internally used function |
list with the results calculated by the used functions
Andri Signorell <andri@signorell.net>
Desc
, PlotMultiDens
, Phrase
x <- d.pizza$temperature
g <- factor(d.pizza$rabate)
# we can change the colors for the plot by setting the DescToolsOptions
DescToolsOptions(col=c(DescTools::horange, DescTools::hgreen))
TwoGroups(x, g, main="Temperature ~ Rebate")
# for an output to Word simply define the wrd argument
# wrd <- GetNewWrd()
# TwoGroups(x, g, font.desc=list(name="Consolas", size=8),
# main="Temperature ~ Rebate", wrd=wrd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.