missing_table: A function to create a summary of missing data for 1 or more...

Description Usage Arguments Details Examples

View source: R/Table1_functions.R

Description

A function to create a summary of missing data for 1 or more groups.

Usage

1
missing_table(data, variables, group, col.names = T)

Arguments

data

a data frame containing the variables listed in variables and the group variable.

variables

a vector or scalar of variables of interest, in quotation marks.

group

an R object. Grouping variable can have >=1 level(s).

col.names

a logical value indicating whether the column labels with group name and sample size are desired.

Details

Can handle >=1 group; number of columns will adjust automatically.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
iris$sepal_di<-as.factor((iris$Sepal.Length<5)*1)
#set factor levels
levels(iris$sepal_di)=c("<5",'>=5')
levels(iris$Species)=c('Setosa','Versicolor','Virginica')
#Set Labels
label(iris$sepal_di)='Sepal Length'
label(iris$Sepal.Length)="Sepal Length"
label(iris$Sepal.Width)='Sepal Width'
label(iris$Petal.Length)='Petal Length'
label(iris$Petal.Width)='Petal Width'
tab_miss<-missing_table(iris,c('Sepal.Length','Petal.Length','Sepal.Width','Petal.Width','sepal_di'),iris$Species)

palmercl/Table1 documentation built on May 14, 2019, 8:55 a.m.