Dear all, I'm analysing a survey, and creating a barchart of the different responses for each question. The questions are grouped according to a number of categories, so I'm using lattice to create a plot with each question in a category on it. The problem is that the response set for different questions within the same category varies. I want to be able to draw only the relevant bars, without spaces for nonrelevant reposnes. An example may make it clearer:
testdf = data.frame(y=c(23,34,45, 56), x=factor(c("a", "a", "b", "c")), g=factor(c(1,2,1,2))) barchart(y~x|g, data=testdf) #In the first panel I would like two columns "a" and "b", positioned at 1 and 2 respectively; in the second I would again like two columns at 1 and 2, this time labelled "a" and "c". barchart(y~x|g, data=testdf, scales=list(x=list(relation="free")), drop.unused.levels=TRUE) #This is closer, but puts the columns in the wrong place in the second panel. Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.