univar: Descriptive Statistics for a Continuous variable

Description Usage Arguments Value See Also Examples

Description

The function provides descriptive statistics for a continuous variable, possibly according to levels of one or several categorical variables.

Usage

1
2
3
4
  univar(formula, data, digits = 3)
  ## S3 method for class 'univar'
print(x, ...)
  

Arguments

formula

A formula. See examples for syntax.

data

A data frame containing the variables indicated in the formula.

digits

A scalar indicating the number of decimal digits left when rounding the result of the statictics.

x

An object of class “univar”.

...

Further arguments to be passed to the functions.

Value

A list with components CALL, tab, nbfact and digits. Component tab is the data frame built according to the formula and function used in the call.

See Also

summary, aggregate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
tmp <- data.frame(
    f1 = c(NA, rep("a", 2), rep("b", 5), NA, "a", "a"),
    f2 = rep(c("c", "d"), times = c(5, 6)),
    f3 = rep(c("e", NA, "f"), times = c(4, 1, 6)),
    y1 = c(rnorm(n = 9, mean = 10, sd = 5), NA, 2.1)
    )
tmp

univar(formula = y1 ~ f1, data = tmp)
univar(formula = y1 ~ f1, data = tmp, digits = 1)
tab <- univar(formula = y1 ~ f1, data = tmp)
tab$tab

univar(formula = y1 ~ 1, data = tmp)

univar(formula = y1 ~ f1 + f2, data = tmp)

  

tdisplay documentation built on May 2, 2019, 4:46 p.m.