Monday, April 8, 2013

RG#42: Association plot (categorical data)

# data 
set.seed (1234)
myd <- data.frame (fact1 = sample (c("A", "B", "C", "D"), 200, replace = TRUE), 
fact2 = sample (c("HL", "PS",  "DS"), 200, replace = TRUE), 
fact3 = sample (c("Male", "Female"), 200, replace = TRUE))

# vcd package is for visualization of categorical data 
mytable <- table (myd)
assoc(mytable, shade=TRUE, legend=TRUE)

No comments:

Post a Comment

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