Re: [R] Adding List Elements To A Data Frame

2013-07-19 Thread Bert Gunter
Folks: I think it worth noting that the solutions provided by Brian and David, which look exactly the same when print()ed, are entirely different beasts. Brian's gives a column of strings; David;s gives a column of lists (a list of lists). str() will provide details. Both solutions are "correct"

Re: [R] Adding List Elements To A Data Frame

2013-07-19 Thread Rui Barradas
Hello, If you create the 3rd column like that, it will be named V3, not z. You must do one of myDataframe$z <- I(myList) myDataframe[["z"]] <- I(myList) Rui Barradas Em 19-07-2013 22:28, David Winsemius escreveu: On Jul 19, 2013, at 12:54 PM, Pete Brecknock wrote: Hi I am trying to add

Re: [R] Adding List Elements To A Data Frame

2013-07-19 Thread David Winsemius
On Jul 19, 2013, at 12:54 PM, Pete Brecknock wrote: > Hi > > I am trying to add the contents of the list "myList" to a new column "z" in > the data frame "myDataframe" > > myList <- list(c("A1","B1"), c("A2","B2","C2"), c("A3","B3")) > > myDataframe <- data.frame(x=c(1,2,3), y=c("R","S","T"))

Re: [R] Adding List Elements To A Data Frame

2013-07-19 Thread Brian Diggs
On 7/19/2013 12:54 PM, Pete Brecknock wrote: > Hi > > I am trying to add the contents of the list "myList" to a new column "z" in > the data frame "myDataframe" > > myList <- list(c("A1","B1"), c("A2","B2","C2"), c("A3","B3")) > > myDataframe <- data.frame(x=c(1,2,3), y=c("R","S","T")) > > Would li

Re: [R] Adding List Elements To A Data Frame

2013-07-19 Thread Pete Brecknock
Thanks Brian. Perfect. Brian Diggs wrote > On 7/19/2013 12:54 PM, Pete Brecknock wrote: >> Hi >> >> I am trying to add the contents of the list "myList" to a new column "z" >> in >> the data frame "myDataframe" >> >> myList <- list(c("A1","B1"), c("A2","B2","C2"), c("A3","B3")) >> >> myDataframe

[R] Adding List Elements To A Data Frame

2013-07-19 Thread Pete Brecknock
Hi I am trying to add the contents of the list "myList" to a new column "z" in the data frame "myDataframe" myList <- list(c("A1","B1"), c("A2","B2","C2"), c("A3","B3")) myDataframe <- data.frame(x=c(1,2,3), y=c("R","S","T")) Would like to produce x y z 1 R A1,B1 2 S A2,B2,C2 3 T A3,B