[R] how to compare different types of graphics in R

wcheckle wcheckle at jhsph.edu
Sat Jun 9 23:04:35 CEST 2012


Dear R users:

I have a continuous outcome variable and four predictors, two continuous and
two dichotomous. i would like to use the lattice plot to create scatter
plots for the continuous predictors and boxplots for the dichotomous
predictors.

with 4 continuous variables, this is what i have been doing:

trial = rbind ( 
cbind ( cimt$ant.mean, cimt$age, 1 ),
cbind ( cimt$ant.mean, cimt$sbp, 2 ),
cbind ( cimt$ant.mean, cimt$ldl, 3 ),
cbind ( cimt$ant.mean, cimt$hdl, 4 ))

trial = as.data.frame(trial)
names(trial) = c("cimt","x","group")

trial$group.f =
factor(trial$group,label=c("Age(years)","SBP(mmHg)","LDL(mg/dL)","HDL(mg/dL)"))
x11(height=6,width=14)
xyplot (cimt~x|group.f, data=trial,
scale=list(x=list(relation="free")),as.table=T,col="dark grey",
strip=strip.custom(which.given=1, bg="transparent"),ylab="Mean CIMT
(mm)",layout=c(4,1),aspect=1:1,xlab="",pch=16)


Any recommendations how to use the lattice package in include 2 dichotomous
variables with two continuous variables?

thank you,

William


--
View this message in context: http://r.789695.n4.nabble.com/how-to-compare-different-types-of-graphics-in-R-tp4632906.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list