Re: [R] create separate plots by factors

2009-08-10 Thread David M Smith
If you want to use foreach to do the looping, you can use the "isplit" function to create an iterator returning blocks of data, each block being the data for one site: > require(foreach) > site.data <- read.table("isplit-data.txt",header=T) # data copied from email > sites <- isplit(site.data,site

Re: [R] create separate plots by factors

2009-08-08 Thread Henrique Dallazuanna
Try this: foo <- function(x, dir = getwd(), ...){ png(file.path(dir, sprintf("%s.png", x))) plot(DF.split[[x]], ...) dev.off() } DF.split <- split(DF[, c("year", "peak")], DF$site) sapply(DF.split, foo) On Fri, Aug 7, 2009 at 4:05 PM, Ingrid Tohver wrote: > Hello, > I am attemptin

[R] create separate plots by factors

2009-08-07 Thread Ingrid Tohver
Hello, I am attempting to create several plots based on "site" (~300 total) and am having trouble with the code. I simply want to create a plot using the code, plot(year, peak), for the following dataset. I would like for each site to be plotted on a separate page and the plots saved in a