Re: [R] adding columns to dataframes contained in a list

2011-05-04 Thread Patrick Connolly
On Wed, 04-May-2011 at 10:25AM +0300, E Hofstadler wrote: |> hi there, |> |> I have a list of 5 identical dataframes: |> |> mydf <- data.frame(x=c(1:5), y=c(21:25)) |> mylist <- rep(list(mydf),5) |> |> and a factor variable with 5 levels: |> |> foo <- c(letters[1:5]) |> foo <- as.factor(foo) |

[R] adding columns to dataframes contained in a list

2011-05-04 Thread E Hofstadler
hi there, I have a list of 5 identical dataframes: mydf <- data.frame(x=c(1:5), y=c(21:25)) mylist <- rep(list(mydf),5) and a factor variable with 5 levels: foo <- c(letters[1:5]) foo <- as.factor(foo) Question: I'd like to add a new variable to each dataframe in the list, each containing onl