Re: [R] Split dataframe into new dataframes

2012-02-10 Thread 538280
I think one of your problems (the others have been addressed by others) is that you want the expression x$y to represent a column of x whose name is stored in y (not the name y itself). The problem here is that the $ notation is a magical shortcut and like any other magic if used incorrectly is li

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread R. Michael Weylandt
You can of course make your own function to do this all "in one step" split2env <- function(x, f, drop = FALSE, ...){ list2env(split(x, f, drop), ...) } But why do you need this for other tasks as a one-liner? M On Wed, Feb 8, 2012 at 6:29 PM, Johannes Radinger wrote: > > Am 08.02.2012 u

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 6:29 PM, Johannes Radinger wrote: Am 08.02.2012 um 23:47 schrieb David Winsemius: On Feb 8, 2012, at 5:06 PM, Johannes Radinger wrote: Am 08.02.2012 um 22:19 schrieb David Winsemius: On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: Hi, I want to split a dataf

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread Johannes Radinger
Am 08.02.2012 um 23:47 schrieb David Winsemius: > > On Feb 8, 2012, at 5:06 PM, Johannes Radinger wrote: > >> >> Am 08.02.2012 um 22:19 schrieb David Winsemius: >> >>> >>> On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: >>> Hi, I want to split a dataframe based on a gro

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 5:06 PM, Johannes Radinger wrote: > > Am 08.02.2012 um 22:19 schrieb David Winsemius: > >> >> On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: >> >>> Hi, >>> >>> I want to split a dataframe based on a grouping variable (in one >>> column). The resulting new >>> dataframes

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread Johannes Radinger
Am 08.02.2012 um 22:19 schrieb David Winsemius: > > On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: > >> Hi, >> >> I want to split a dataframe based on a grouping variable (in one column). >> The resulting new >> dataframes should be stored in a new variable. I tried to split the >> dat

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: Hi, I want to split a dataframe based on a grouping variable (in one column). The resulting new dataframes should be stored in a new variable. I tried to split the dataframe using split() and to store it using a FOR loop, but thats not

[R] Split dataframe into new dataframes

2012-02-08 Thread Johannes Radinger
Hi, I want to split a dataframe based on a grouping variable (in one column). The resulting new dataframes should be stored in a new variable. I tried to split the dataframe using split() and to store it using a FOR loop, but thats not working so far: df <- data.frame(A=c("A1","A1","A2","A2"),B