Here's an example for the data set from assignment 1: king <- read.csv("KingCounty2001_data.txt", header=TRUE) king$is.low.bwt <- as.integer(king$bwt < 2500) king$firstep <- factor(king$firstep, labels=c("No", "Yes")) king$educat <- cut(king$edu, c(-Inf, 11, 12, 15, 16, Inf), labels=c("High school not completed", "High school graduate", "Some college", "College graduate", "Postgraduate studies")) king$paritycat <- cut(king$parity, c(-Inf, 0, 2, Inf), labels=c("First pregnancy", "1 or 2 previous pegnancies", "More than 2 previous pregnancies")) sink("table1.tex") latex.descriptive.table(firstep ~ age + race + paritycat + married + welfare + smoker + drinker + wpre + educat, data=king, columns.desc="Participated in First Steps program", labels=c("Mother's age", "Mother's race", "Mother's parity", "Married", "Welfare recipient", "Mother's smoking status", "Mother's drinking status", "Maternal weight prior to pregnancy", "Mother's education")) sink()