Descriptives with confidence intervals

descriptiveCIs(
  data,
  items = NULL,
  itemLabels = NULL,
  conf.level = 0.95,
  digits = 2
)

# S3 method for rosettaDescriptiveCIs
print(x, digits = attr(x, "digits"), forceKnitrOutput = FALSE, ...)

Arguments

data

The data frame holding the data, or a vector.

items

If supplying a data frame as data, the names of the columns to process.

itemLabels

Optionally, labels to use for the items (optionally, named, with the names corresponding to the items; otherwise, the order of the labels has to match the order of the items)

conf.level

The confidence level of the confidence intervals.

digits

The number of digits to round the output to.

x

The object to print (i.e. the object returned by descriptiveCIs).

forceKnitrOutput

Whether to force knitr output even when not knitting.

...

Any additional arguments are passed on to knitr::kable() or to base::print().

Value

A data frame with class rosettaDescriptiveCIs prepended to allow printing neatly while knitting to Markdown.

Examples

descriptiveCIs(mtcars);
#>      mean.ci.lo mean.point mean.ci.hi sd.ci.lo sd.point sd.ci.hi
#> mpg       17.92      20.09      22.26     4.83     6.03     8.01
#> cyl        5.54       6.19       6.83     1.43     1.79     2.37
#> disp     186.04     230.72     275.41    99.36   123.94   164.77
#> hp       121.97     146.69     171.41    54.97    68.56    91.15
#> drat       3.40       3.60       3.79     0.43     0.53     0.71
#> wt         2.86       3.22       3.57     0.78     0.98     1.30
#> qsec      17.20      17.85      18.49     1.43     1.79     2.38
#> vs         0.26       0.44       0.62     0.40     0.50     0.67
#> am         0.23       0.41       0.59     0.40     0.50     0.66
#> gear       3.42       3.69       3.95     0.59     0.74     0.98
#> carb       2.23       2.81       3.39     1.29     1.62     2.15
#> 
#> Note: these are 95% confidence intervals.