Learn R Programming

report (version 0.1.0)

report_sample: Sample Description

Description

Create sample description table (Table 1).

Usage

report_sample(
  data,
  group_by = NULL,
  centrality = "mean",
  select = NULL,
  exclude = NULL,
  weights = NULL,
  total = TRUE,
  digits = 2,
  ...
)

Arguments

data

A data frame for which descriptive statistics should be created.

group_by

Character vector, indicating the column for possible grouping of the descriptive table.

centrality

Character, indicates the statistics that should be calculated for numeric variables. May be "mean" (for mean and standard deviation) or "median" (for median and median absolute deviation) as summary.

select

Character vector, with column names that should be included in the descriptive table.

exclude

Character vector, with column names that should be excluded from the descriptive table.

weights

Character vector, indicating the name of a potential weight-variable. Reported descriptive statistics will be weighted by weight.

total

Add a Total column.

digits

Number of decimals.

...

Arguments passed to or from other methods.

Value

A data frame of class report_table1 with variable names and their related summary statistics.

Examples

Run this code
# NOT RUN {
data(iris)
report_sample(iris[, 1:4])
report_sample(iris, select = c("Sepal.Length", "Petal.Length", "Species"))
report_sample(iris, group_by = "Species")
# }

Run the code above in your browser using DataLab