Description Usage Arguments Details Author(s) Examples
The tbl1() function will create a typical descriptive table for categorical and continuous variables. Frequencies are stratified by an exposure variable. Percentages can be calculated as column or row percents.
1 | tbl1(dat, variable, stratvar, percents=2, freq.type=0)
|
dat |
A data.frame in which to interpret the variables used in the function. |
variable |
Main frequency variable or vector of variables. In an N*N table, this would correspond to the rows |
stratvar |
Strata variable. In an N*N table, this would correspond to the columns |
percents |
1=row percents; 2=column percents (default); 0=overall percents |
freq.type |
0=Both N and (percent); 1= N-only; 2=Percentages-only |
The tbl1() function will take any set of variables and calculate frequencies (N and percentages) across strata of another variable and format the output typical for BERG Table 1 publications. Output for continuous variables will be mean (SD), categorical variables will be N (percent). Total output is formatted so that continuous variables are at the top of the table, followed by results for categorical variables. Final output is a data frame.
Brian Carter
1 2 3 4 | df <- example_data
table1 <- tbl1(dat=df,
variable=c("bmi92","age92m","smoke92","educ"),
stratvar="myeloid")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.