dt_create: Create a dt object

Description Usage Arguments Value Examples

View source: R/create.R

Description

Create a dt object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dt_create(
  data,
  group = NULL,
  stat_num = "median",
  digits = 2,
  spec_var = NULL,
  keep_missing = F,
  compare = T,
  overall = F
)

Arguments

data

A data frame which contains only factor or numeric variables.

group

A variable name as characters or symbol which define groups.

stat_num

Characters. Specify the statistic to describe numeric variables, "median" (default) provides median, first and third quartiles, "mean" provides mean and standard deviation.

digits

Integer. Specify the number of digits to display.

spec_var

List. A named list of the variables for which you want specify row name, number of digits to display or just ordering the rows. Each variable-named element need to be a named list (with name and digit elements) or NULL. If provides here, the specific digit argument overwrite the general digits argument. The order of the variable-named element define the order of rows in the table.

keep_missing

Logical. If FALSE (default) observations which have a missing value for the grouping variable are exclude from the dataset. Otherwise an extra group named "Missing data" will be add to the table to describe this observations.

compare

Logical. If TRUE (default) a statistical comparison is added to the table.

overall

Logical. If TRUE an extra column with the statistics of the entire dataset will be added to the table.

Value

A dt object (a list)

Examples

1
dt_create(data, group = treatment, stat_num = "mean")

jrmie/dtr documentation built on April 22, 2020, 10:32 p.m.