Monday, April 8, 2013

RG#40: Spine plot


set.seed(123)
myd <- data.frame (grp1 = rep(c("A", "B", "C", "D"), each = 5), grp2 = rep(c("G1", "G2", "G3", "G4", "G5"), 4), yvr1 = rnorm (20, 10,3), yvr2 = rnorm (20, 50,12))


 require(grDevices)


# plotting 
spineplot(grp1 ~ grp2, data = myd, col = c("gray50",  "blue", "green4", "tan", "purple"))




## (dependence on a numerical variable)
spineplot(grp1 ~ yvr1, data=myd)
spineplot(grp1 ~ yvr1, data=myd, breaks = 3, col = c("green1", "green3", "darkgreen"))
spineplot(grp1 ~ yvr1, data=myd,breaks = quantile(myd$yvr1) )



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.