prop_row: A row function

Description Usage Arguments Details Examples

View source: R/Table1_functions.R

Description

Creates no. and percentage for each level of the variable, with a p-value from Chi-square test or Fisher's exact test.

Usage

1
prop_row(y, x, margin, single)

Arguments

Variable

An R object. Categorical variable of interest.

Group

An R object. Group variable.

Margin

a vector giving the desired margin to calculate percentages in the table for each group. 1 indicates rows, 2 indicates columns.

Details

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

Test based on expected cell value <5. Will only return row for last level of the factor.

Examples

1
2
3
4
x<-rep(c('Red','Blue'),c(10,40))  
y<-rep(c('A','B'), 25) 
prop_row(x,y)
prop_row()

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