Re: [R] Plot factors with a loop

2009-09-20 Thread baptiste auguie
Hi, >From what I understand, I would suggest the following strategy, 1- combine all data in a single data.frame (see merge, rbind, reshape package, etc.) 2- plot all data at once using a formula like this, boxplot(d~f,data=df) HTH, baptiste 2009/9/20 Sam Player : > # I have a dataframe with

Re: [R] Plot factors with a loop

2009-09-20 Thread johannes rara
Why do you need to do this using loop? Is this what you want? a <- rep(c("a", "b", "c"), 6) df <- data.frame(f=a, d=rnorm(18)) df boxplot(df$d ~ df$f) 2009/9/20 Sam Player : > # I have a dataframe with a factor and data: > > a <- rep(c("a", "b"), c(6,6)) > df <- data.frame(f=a, d=rnorm(12)) > df

[R] Plot factors with a loop

2009-09-20 Thread Sam Player
# I have a dataframe with a factor and data: a <- rep(c("a", "b"), c(6,6)) df <- data.frame(f=a, d=rnorm(12)) df # I want to make a single plot with boxplots of each factor. I need to do it via a loop as I would like to apply it to other dataframes with many factors. The following is a loop th