mytable_sub: Produce table for descriptive statistics In moonBook: Functions and Datasets for the Book by Keon-Woong Moon

Description

Produce table for descriptive statistics by groups for several variables easily. Depending on the nature of these variables, different descriptive statistical methods were used(t-test, ANOVA,Kruskal-Wallis, chisq, Fisher,...)

Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```mytable_sub( x, data, use.labels = TRUE, use.column.label = TRUE, max.ylev = 5, maxCatLevel = 20, digits = 1, method = 1, catMethod = 2, show.all = FALSE, exact = FALSE, show.total = FALSE ) ```

Arguments

 `x` An object of class "formula". Left side of ~ must contain the name of one grouping variable or two grouping variables in an additive way(e.g. sex+group~), and the right side of ~ must have variables in an additive way. `data` A data.frame contains data for analysis `use.labels` Logical. Whether or not use labels. `use.column.label` Logical. Whether or not use column labels. `max.ylev` An integer indicating the maximum number of levels of grouping variable ('y'). If a colummn have unique values less than max.ylev it is treated as a categorical variable. Default value is 5. `maxCatLevel` An integer indicating the maximum number of unique levels of categorial variable. If a colummn have unique values more than maxCatLevel, categorical summarization will not be performed. `digits` An integer indicating the number of decimal places (round) or significant digits to be used. Default value is 1. `method` An integer indicating methods for continuous variables. Possible values in methods are 1forces analysis as normal-distributed 2forces analysis as continuous non-normal 3performs a Shapiro-Wilk test to decide between normal or non-normal Default value is 1. `catMethod` An integer indicating methods for categorical variables. Possible values in methods are 0Perform chisq.test first. If warning present, perform fisher test 1Perform chisq.test without continuity correction 2Perform chisq.test with continuity correction 3perform fisher.test 4perform prop.trend test Default value is 2. `show.all` A logical value indicating whether or not all statistical values have to be shown in table. Default value is FALSE. `exact` A logical value indicating whether or not permit call with approximate parameter. If true, only exact column name permitted.Default value is FALSE. `show.total` A logical value indicating whether or not show total group value. Default value is FALSE.

Value

An object of class "mytable". 'print' returns a table for descriptive statistics. 'summary' returns a table with all statistical values.

moonBook documentation built on Jan. 13, 2021, 6:43 a.m.