eclipse - R: Custom summary stats table defined as matrix for export to Word -
i want create simple custom r table summary statistics. me, or hard in r? after perusing packages tables, xtables, , stargazer opted make table defining matrix rows , column want (see code below). problem it's not suitable export, plus don't know how export (i need in word). use r in eclipse, don't have latex or sweave.
how can format table it's pretty , export use elsewhere?
data available here: https://www.dropbox.com/sh/s9t9ejvrs1w1848/aaaqdryxieturjtcikio5txqa?dl=0
table1 <- as.table(matrix(c(length(dem$empi), percent(length(dem$gender[dem$gender=="male"])/length(dem$gender)), percent(length(dem$race[dem$race=="white"])/length(dem$race)), percent(length(dem$race[dem$race=="black"])/length(dem$race)), paste(round(mean(dem$age),1), " (", round(sd(dem$age),1),")", sep=""), paste(length(dem$vital_status[dem$vital_status=="deceased"]), " (", percent(length(dem$vital_status[dem$vital_status=="deceased"])/400), ")", sep=""), round(length(edvisits$empi)/c(length(dem$empi)),1), round(length(dia$dia_date)/400,1)), ncol=1, byrow=false, dimnames=list(c("# patients", "% male", "% white", "% black", "age (sd)", "deceased (%)", "avg ed visits", "avg diagnoses per patient"), "emergency department visits, 2010-2012")))
Comments
Post a Comment