Reputation: 293
So I have a fairly large dataset of GPS locations corresponding to different individuals at different times. It looks like a more complicated version of this...
ID________________Year________________Julian.date________________Distance
1_________________2003______________________15_____________________200
1_________________2004______________________20_____________________500
1_________________2005______________________24_____________________462
1_________________2006______________________28_____________________51
2_________________2002______________________12_____________________248
2_________________2003______________________15_____________________571
2_________________2004______________________16_____________________685
3_________________2003______________________20_____________________521
3_________________2004______________________25_____________________1251
3_________________2005______________________29_____________________225
3_________________2006______________________54_____________________144
What I am trying to do is separate the data out by year and individual. So each individual with have a boxplot of their Distances and the corresponding Julian date. I am able to create a massive pdf of all the plots (12X11) on one sheet using the lattice package (Separator is a column combining the ID and Year columns)..
> barchart(Julian.date~Distance|factor(Separator),data=data)
This isn't particularly helpful as I can't do much with such a massive pdf. So I tried restricting the number of plots per sheet to 1 using...
> barchart(Julian.date~Distance|factor(Separator),data=data,layout=c(1,1))
Which results in all the plots flying past me and none of them exporting to pdf. I have tried searching for a way to accomplish this, but so far no luck. If anyone knows a way of getting these to export as they fly past I would be extremely thankful.
So thanks in advance if anyone out there can help out. And if you need any more information, let me know, I tend not to use the terminology properly.
Ayden
Upvotes: 0
Views: 289
Reputation: 174843
I'm not sure what you are doing, or doing wrong as you don't show code, but using an example modified from ?barchart
I see a PDF with multiple pages using this code:
foo <- barchart(yield ~ variety | site, data = barley,
groups = year, layout = c(1,1), stack = TRUE,
auto.key = list(space = "right"),
ylab = "Barley Yield (bushels/acre)",
scales = list(x = list(rot = 45)))
pdf("foo.pdf", onefile = TRUE)
print(foo)
dev.off()
onefile = TRUE
should be the default and allows multiple pages in a single PDF. The other thing I do is print the barchart object in the pdf()
wrapper; again, I don't think this is required if you are running R interactively but it will be needed if this is a batch or script based job.
Upvotes: 2