Description Usage Arguments Value See Also Examples
View source: R/univariateSummary.R
univariateSummary()
produces a univariate summary table,
evaluating x
as the independent variable and y
as the dependent
variable. It uses the S3 generic function bin
to bin the values of
x
, then per bin, applies FUN
to y
. The vector x
can include
missing values but y
cannot. When ytype = 1
, y
must
contain only unique (coercable) values of 0 or 1. When ytype = 2
,
y
must have at least 3 distinct values.
1 | univariateSummary(x, y = rep(0, length(x)), ytype = 1, FUN = mean, ...)
|
x |
character, factor, logical or numeric vector (independent variable) |
y |
logical, integer or numeric vector (dependent variable) |
ytype |
integer value of 1 (binary y) or 2 (continuous y) |
FUN |
function to be applied to |
... |
further arguments passed to |
A data frame with class "mt_univariateSummary
" containing the
following columns:
xbin
: binned values of x (character)
Freq
: frequency of observations (integer)
Percent
: relative frequency of observations (numeric)
yagg
: aggregated summary statistic of y (numeric)
1 2 3 4 5 6 7 8 9 | # character x, continuous y
z <- univariateSummary(iris$Species, iris$Sepal.Length, ytype = 2)
print(z)
class(z)
# numeric x, logical y, additional arguments to bin()
z <- univariateSummary(mtcars$hp, mtcars$mpg > 15, numBins = 2)
print(z)
class(z)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.