Hi all, I am having a problem using xyplot from lattice library. I am plotting one variable against another one, conditioning on two other variablesm one of which has 3 levels and the other 6 levels. The output is thus a 6x3 panel plot. Here's my code: print((xyplot(CloDurPercent[CloDurNA != 'NA' & Mscor<3.5]~ConsDur[CloDurNA != 'NA' & Mscor<3.5]|Pos*ConsId, data = Stops, pch = '.')) One of the panels is not plotting the data in it -- it remains blank. I first thought that I had some problem with this particular data subset but no, when I reordered levels and plotted the data again, a different subset is not showing up in the same panel as before. This is the outcome whether I print on the Quartz device or save the plot to a .ps file. What's going on? Is there some hardware/software interaction problem? I am using R 1.14 on MacOS X 10.3.9. Thanks, alina -- View this message in context: http://r.789695.n4.nabble.com/problem-with-xyplot-tp3391822p3391822.html Sent from the R help mailing list archive at Nabble.com.
Are Pos and Consld -- which CANNOT be in Stops -- the same length unsubscripted as the subscripted variables? Do all the combinations of levels of these variables actually occur (you can check with table() )? You would also probably do better to use the subset argument of xyplot to subset the data to be plotted. -- Bert On Sun, Mar 20, 2011 at 1:06 PM, askh <akhasanova at nawaz.org> wrote:> Hi all, > > I am having a problem using xyplot from lattice library. I am plotting one > variable against another one, conditioning on two other variablesm one of > which has 3 levels and the other 6 levels. The output is thus a 6x3 panel > plot. Here's my code: > > print((xyplot(CloDurPercent[CloDurNA != 'NA' & Mscor<3.5]~ConsDur[CloDurNA > != 'NA' & Mscor<3.5]|Pos*ConsId, data = Stops, pch = '.')) > > One of the panels is not plotting the data in it -- it remains blank. I > first thought that I had some problem with this particular data subset but > no, when I reordered levels and plotted the data again, a different subset > is not showing up in the same panel as before. This is the outcome whether I > print on the Quartz device or save the plot to a .ps file. ?What's going on? > Is there some hardware/software interaction problem? I am using R 1.14 on > MacOS X 10.3.9. > > Thanks, > > alina > > -- > View this message in context: http://r.789695.n4.nabble.com/problem-with-xyplot-tp3391822p3391822.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >-- Bert Gunter Genentech Nonclinical Biostatistics
On Mar 20, 2011, at 4:06 PM, askh wrote:> Hi all, > > I am having a problem using xyplot from lattice library. I am > plotting one > variable against another one, conditioning on two other variablesm > one of > which has 3 levels and the other 6 levels. The output is thus a 6x3 > panel > plot. Here's my code: > > print((xyplot(CloDurPercent[CloDurNA != 'NA' & > Mscor<3.5]~ConsDur[CloDurNA > != 'NA' & Mscor<3.5]|Pos*ConsId, data = Stops, pch = '.')) > > One of the panels is not plotting the data in it -- it remains > blank. I > first thought that I had some problem with this particular data > subset but > no, when I reordered levels and plotted the data again, a different > subset > is not showing up in the same panel as before. This is the outcome > whether I > print on the Quartz device or save the plot to a .ps file. What's > going on? > Is there some hardware/software interaction problem? I am using R 1.14Really? If that is true then you are way, way behind the times. You may be offered a prize for the most ancient version in use. (Even if you were using the Mac-GUI version it would still be 5 years out of date.> on > MacOS X 10.3.9.Well, maybe you are.>Hardware issues are still very unlikely. The construction CloDurNA != 'NA' will not do what you think it does. Try: !is.na(CloDurNA) #instead You could take a variable that should exist for every category and do something lik: require(Hmisc) # or some other package with a describe function with(CloDurPercent, tapply(CloDurPercent[!is,na(CloDurNA) & Mscor<3.5], c(ConsId, Pos, CloDurPercent[!is,na(CloDurNA) & Mscor<3.5]), describe) Should give you a count of NA's and if all are missing in a particular category you will get all TRUE in one cell. It might be prudent to upgrade if that was not a typo and provide more information about your dataset -- David:> Thanks, > > alina > > -- > View this message in context: http://r.789695.n4.nabble.com/problem-with-xyplot-tp3391822p3391822.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.David Winsemius, MD Heritage Laboratories West Hartford, CT
Thank you all for the help. After I used proper subsetting, it all worked fine. And yes, I am open to receiving a prize for the most ancient version of R in use... Best, alina -- View this message in context: http://r.789695.n4.nabble.com/problem-with-xyplot-tp3391822p3398070.html Sent from the R help mailing list archive at Nabble.com.