I have the following code:
#Loading libraries
library(grid)
library(vcd)
#creating table
ds = array(c(14,4,7, 10,15,9, 3,11,5), dim=c(3,3),
dimnames=list('Radio Format Preference'=c('Music','News-talk','Sports'), 'Age'=c('Young Adult','Middle Age','Older Adult')))
ds = as.table(ds)
#Calculate row and column proportions
ft = ftable(ds)
pro_row = prop.table(ft,1)
pro_col = prop.table(ft,2)
#plot mosaic
mosaic(ds,legend=TRUE,shade=TRUE)
My problem is that my mosaic plot stays greyed out, even though I set shade=TRUE
.
What am I missing here?