descriptiveTable: Descriptive Table for Continuous, Categorical, and Date...

View source: R/descriptiveTable.R

descriptiveTableR Documentation

Descriptive Table for Continuous, Categorical, and Date Variables

Description

Descriptive table for continuous, categorical, and date variables.

Usage

descriptiveTable(
  formula,
  data,
  guess.categorical = 5,
  add.groupAll = TRUE,
  add.groupNA = TRUE,
  add.groupVariable = FALSE,
  FCT.center = "mean",
  FCT.spread = "sd",
  test.categorical = NULL,
  test.continuous = NULL
)

Arguments

formula

[formula] A formula where the left hand side (lhs) describe potential subgroups and the right hand side (rhs) the variable to be described.

data

[data.frame/data.table] Dataset

guess.categorical

[integer,>0] When the type of the variables is not specified, numeric variables with number of unique values lower than the specified value are treated as categorical variabels.

add.groupAll

[logical] should the descriptives of the whole dataset be computed?

add.groupNA

[logical] should the descriptives of the observations where the group variable is missing be computed?

add.groupVariable

[logical] should the name of the variable used to generate the sub-groups be printed in the table.

FCT.center

[function] function used to assess the center of the distribution.

FCT.spread

[function] function used to assess the spread of the distribution.

test.categorical

[function] function used to compute the p-value when comparing the categorical outcomes across sub-groups.

test.continuous

[function] function used to compute the p-value when comparing the continuous outcomes across sub-groups.

Examples

data(veteran, package = "survival")

descriptiveTable( ~ celltype + time + status +karno,
                 data = veteran)
descriptiveTable(trt ~ celltype + time + status +karno,
                 data = veteran)
tt <- descriptiveTable(trt ~ celltype + time + status +karno,
                       data = veteran, test.continuous = t.test)

bozenne/butils documentation built on Oct. 14, 2023, 6:19 a.m.