Dùng thư viện và mã lệnh table1
library(readxl)
tlsosinh <- read_excel("C:/PTSL YHDP16/tlsosinh.xlsx")
Nhóm tuổi
ntuoime <- tuoime
ntuoime [tuoime<30] <- "<30"
ntuoime [tuoime>=30 & tuoime<35] <- "30-34tuoi"
ntuoime [tuoime>=35 & tuoime<40] <- "35-39tuoi"
ntuoime [tuoime>=40] <- ">=40 tuoi"
Sinh non
sinhnon <- tuoithai
sinhnon[tuoithai<37]<- "Co"
sinhnon[tuoithai>=37] <- "Khong"
Nhẹ cân
nhecan <- tlsosinh
nhecan[tlsosinh<2500] <- "Co"
nhecan[tlsosinh>=2500]<- "Khong"
Bảng 1: Đặc điểm của mẹ
table1(~ ntuoime+nghenghiep+cha, data = tlsosinh)
Bảng 2: Đặc điểm của trẻ
table1(~ tlsosinh + tuoithai + gioi + sinhnon, data = tlsosinh)
Bảng 3: Đặc điểm của trẻ theo tăng HA mẹ
table1(~ tlsosinh + tuoithai + gioi + sinhnon|cha, data = tlsosinh)
Bảng 4: Đặc điểm của trẻ theo ngành nghề của mẹ
table1(~ tlsosinh + tuoithai + gioi + sinhnon|nghenghiep, data = tlsosinh)