table3 | R Documentation |
Creates 'Table 3' which is about stratified analysis. The three regression methods include general linear regression, logistic regression and cox proportional hazards regression.
table3( x, y, data, split_var, y_time = NULL, adj = c(), split_div = list(), outformat = 4, method = "general" )
x |
A string. The independent variable to be summarized given as a string. |
y |
A string. The dependent variable to be summarized given as a string. |
data |
A data frame in which these variables exist. |
split_var |
A vector of strings. Strata variables to be summarized given as a character vector. |
y_time |
A string. The survival time variable to be summarized given as a string. It only works when |
adj |
A vector of strings, default = |
split_div |
A list containing numeric vectors or a vector of integers that are summarized given as a string, default |
outformat |
|
method |
( |
An object about stratified analysis.
## Load Mayo Clinic Primary Biliary Cirrhosis Data library(survival) library(tableeasy) data(pbc) ## Check variables head(pbc) ##The censored data is not discussed here pbc_full <- subset(pbc,status!=0) pbc_full$status <- pbc_full$status-1 ## Make categorical variables factors varsToFactor <- c('status','trt','ascites','hepato','spiders','edema','stage','sex') pbc_full[varsToFactor] <- lapply(pbc_full[varsToFactor], factor) ## Moderator variables adj_pbc <- c('age','alk.phos','ast') ## Converts the continuous variables named 'albumin' to a categorical variable named 'albumin_2'. albumin_2 <- div_quantile('albumin',div = c(2),pbc_full) pbc_full <- data.frame(pbc_full,'albumin_2' = albumin_2) ## General linear regression: table3(x = 'albumin_2', y = 'bili', adj = c(), data = pbc_full, split_var = c('age','alk.phos','ast','trt'), split_div = list(), outformat = 1) ## Logistic regression: table3(x = 'albumin_2', y = 'status', adj = adj_pbc, data = pbc_full, split_var = c('age','alk.phos','ast','trt'), split_div = list(c('2','3'),c('3')), outformat = 2,method = 'logistic') ## Cox proportional hazards regression: table3(x = 'albumin_2',y = 'status',y_time = 'time', adj = adj_pbc,data = pbc_full, split_var = c('age','alk.phos','ast','trt'), split_div = list(c(45),c(1500,1700),c(),c()), outformat = 3,method = 'cox')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.