You could plot both histograms into the same file using this:
library(lattice)
jpeg(filename="combined.jpeg")
histogram(~d|f, data = df)
dev.off()
Schalk Heunis
On Sat, Sep 19, 2009 at 11:37 AM, Sam Player wrote:
> # I have a dataframe with data and factors similar to the following:
>
> a <- r
On Sep 19, 2009, at 5:37 AM, Sam Player wrote:
# I have a dataframe with data and factors similar to the following:
a <- rep(c("a", "b"), c(6,6))
df <- data.frame(f=a, d=rnorm(12))
df
# I am trying to write a 'for' loop which will produce a jpeg
histogram for each factor. I can individually
Sam,
Your loop produces two jpegs but the second overwrites the first.
What do you expect
levels(df[i,"f"])
to produce? (Think about it.)
Try
jpeg(filename=paste(i,".jpg",sep=""))
and you may want to fix the titles as well.
Peter
Sam Player wrote:
# I have a dataframe with data and fac
3 matches
Mail list logo