## Data from MASS package ##
library(MASS)
data("birthwt")
library(dplyr)
b = mutate(.data=birthwt,
smoke = as.factor(smoke),
race = as.factor(race),
ht = as.factor(ht),
ui = as.factor(ui))
levels(b$race) = c("white", "black", "other")
library(furniture)
table1(b, age, race, smoke, ptl, ht, ui, ftv, NAkeep=TRUE)
table1(b, age, race, smoke, ptl, ht, ui, ftv,
splitby=~factor(low),
NAkeep=TRUE)
b$low = as.factor(b$low)
table1(b, age, race, smoke, ptl, ht, ui, ftv,
splitby=~low,
test=TRUE,
var_names = c("Age", "Race", "Smoking Status", "Previous Premature Labors", "Hypertension",
"Uterine Irratibility", "Physician Visits"),
splitby_labels = c("Regular Birthweight", "Low Birthweight"))
Run the code above in your browser using DataLab