tabkris_2: Data description function

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/tabkris2.r

Description

tabkris_2 computes descriptive statistics for data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
tabkris_2(
  data,
  names = NULL,
  varint = NULL,
  lang = "en",
  method = NULL,
  test = FALSE,
  pres_quant = c("med"),
  pres_quali = c("n", "per"),
  default_method = c("cont", "bino", "cate", "ordo"),
  default_test = c("stud", "chisq", "chisq", "chisq"),
  explicit_na = FALSE,
  digits = 2,
  return_table = TRUE,
  auto_detect = TRUE,
  lev_co = 10,
  verbose = FALSE
)

Arguments

data

Dataframe to describe or a "desctable" object

names

Vectors of variables to display in the final table, length of ncol(data)

varint

Variable to stratify on, factor only

lang

Language to display, default "en", "fr"

method

Vectors of variables to customize the methods used for description, length of data columns

test

Either a logical indicating statistical tests execution or a vectors of variables to customize the tests, length of data columns. Default FALSE

pres_quant

Descriptive statistics for quantitative variables. Possible values are "mean" for mean, SD, "med" for median, IQR, "range" for range

pres_quali

Descriptive statistics for qualitative variables. Possible values are "n" for number, "total" to add "/ total" and "per" for percentages

default_method

Default method to compute the table for each variable. Default default_method = c("cont", "bino", "cate", "ordo")

default_test

Default test to apply for each variable type. Default c("stud", "chisq", "chisq", "chisq"). Available "stud", "wilcox", "kruskal", "chisq", "fish"

explicit_na

Whether to display NA in description, Default FALSE

digits

Number of significant number to display, default 2

return_table

Whether to return a dataframe or an object to customize option easily, default TRUE

auto_detect

Whether to automatically detect variable type, transforming to factors numeric variable with moderate levels (< 10), default TRUE. Possible to set the cut-off number with lev_co

lev_co

Numeric. When auto_detect is TRUE, set the number of level to cutoff for categorical variables

verbose

Logical. Display information about transformation of variables. default FALSE

Details

The tabkris_2 function is a function to describe a set of data. Main purpose is to create a typical table one in biomedical litterature, either a patient characteristic table or population characteristic table.

names is a vector to name the variable of data. Default will use the colnames of data.

varint is a variable to stratify the analysis. It must be included in the initial dataset. It will not be displayed in the final table if chosen as the stratifying variable

lang is useful to choose the language for the final display. The default is english. French is also supported.

default_method and method are used to set the methods used for display. default_method must be length 4, to set the default method for continuous, binomial, categorical and ordered variable. method must be length of data columns, used to fine-tune every method for each variable.

default_test and test are used to set the tests performed. default_test must be lenght 4, to set the default method for continuous, binomial, categorical and ordered variable. test must be length of data columns, used to fine-tune every test for each variable.

pres_quant is used to set the display of quantitative variable. mean (SD), median [IQR] and range are available, default is median.

pres_quali is used to set the display of qualitative variable. "n" for number, "total" to add "/ total" and "per" for percentages, default is "n / per".

explicit_na is used to display.

digits is the number of digits to display for numbers. Usually if n < 100, digits = 0 if 100< n < 200, digits = 1 else digits = 2.

return_table choose if the user wants to directly display a table or if the user wants to get an object with parametrable objects.

auto_detect will test if each column can be coerced to a factor (i.e. having between 2 and 10 levels) and change the type of variable if so.

lev_co will set the number of maximum levels to coerce a column in a factor

Value

Depending on argument return_table, an object of class data.frame, which is the descriptive table or an object of class "desctable", which is a customizable object.

Author(s)

Yves Gallien yves.gallien@gmail.com, 2019

See Also

https://github.com/Ygall/CRUF for manual and examples.

Examples

1

CRUF documentation built on March 13, 2020, 1:34 a.m.