Learn R Programming

compareGroups (version 0.1-3)

createTable: Table of descriptives by groups: bivariate table

Description

This functions builds a 'compact' and 'nice' table with the descriptives by groups.

Usage

createTable(x, hide = NA, digits = NA, type = NA, show.all = 
            TRUE, show.p.trend = FALSE, show.p.mul = FALSE, show.n = FALSE)

Arguments

x
an object of class 'compareGroups'
hide
an integer vector with as many components as row-variables. If it has length 1 it is recycled for all row-variables. Each component specifies which category must be hidden and not shown. This argument only applies to categorical row-variables, and for con
digits
an integer vector with as many components as row-variables. If it has length 1 it is recycled for all row-variables. Each component specifies the number of significant decimals to be displayed. Or a named vector specifying which row-variables 'digits' is
type
an integer. 2 or NA - absolute and relative frequencies in brackets are shown; 1- only relative frequencies are displayed
show.all
logical indicating whether the '[ALL]' column (all data without stratifying by groups) is displayed or not. Default value is TRUE
show.p.trend
logical indicating whether p-trend is displayed or not. It is always FALSE when there are less than 3 groups. Default value is FALSE.
show.p.mul
logical indicating whether the pairwise (between groups) comparisons p-values are displayed or not. It is allways FALSE when there are less than 3 groups. Default value is FALSE.
show.n
logical indicating whether number of individuals analysed for each row-variable are displayed or not in the 'descr' table. Default value is FALSE

Value

  • An object of class 'createTable', which contains a list of 2 matrix:
  • descra character matrix of descriptives for all row-variables by groups and p-values in a 'compact' format
  • availa character matrix indicating the number of available data for each group, the type of variable (categorical, continuous-normal or continuous-non-normal) and the individuals selection made (if non selection 'ALL' is displayed.)
  • 'print' returns these two tables. The first one, 'descr', in a 'nice' format. 'update' modifies previous results from 'createTable'.

See Also

compareGroups, export2latex, export2csv

Examples

Run this code
data(myData)

ans<-compareGroups(y~.,myData)
anstab<-createTable(ans)
anstab
update(anstab,show.n=TRUE)

Run the code above in your browser using DataLab