Re: [R] Split a dataframe by rownames and/or colnames

2015-02-23 Thread David Winsemius
On Feb 23, 2015, at 4:03 AM, Tim Richter-Heitmann wrote: > Thank you very much for the line. It was doing the split as suggested. > However, i want to release all the dataframes to the environment (later on, > for each dataframe, some dozen lines of code will be carried out, and i dont > know h

Re: [R] Split a dataframe by rownames and/or colnames

2015-02-23 Thread Sergio Fonda
Did you try "dplyr" package? Sergio Il 23/feb/2015 13:05 "Tim Richter-Heitmann" ha scritto: > Thank you very much for the line. It was doing the split as suggested. > However, i want to release all the dataframes to the environment (later > on, for each dataframe, some dozen lines of code will be

Re: [R] Split a dataframe by rownames and/or colnames

2015-02-23 Thread Tim Richter-Heitmann
Thank you very much for the line. It was doing the split as suggested. However, i want to release all the dataframes to the environment (later on, for each dataframe, some dozen lines of code will be carried out, and i dont know how to do it w lapply or for-looping, so i do it separately): li

Re: [R] Split a dataframe by rownames and/or colnames

2015-02-20 Thread David Winsemius
On Feb 20, 2015, at 9:33 AM, Tim Richter-Heitmann wrote: > Dear List, > > Consider this example > > df <- data.frame(matrix(rnorm(9*9), ncol=9)) > names(df) <- c("c_1", "d_1", "e_1", "a_p", "b_p", "c_p", "1_o1", "2_o1", > "3_o1") > row.names(df) <- names(df) > > > indx <- gsub(".*_", "", nam

Re: [R] Split a dataframe by rownames and/or colnames

2015-02-20 Thread Bert Gunter
I think ?tapply and friends: ?by ?aggregate ?ave is what you want. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Clifford Stoll On Fri, Feb 20, 2015 at 9:33 AM, Tim Ri

[R] Split a dataframe by rownames and/or colnames

2015-02-20 Thread Tim Richter-Heitmann
Dear List, Consider this example df <- data.frame(matrix(rnorm(9*9), ncol=9)) names(df) <- c("c_1", "d_1", "e_1", "a_p", "b_p", "c_p", "1_o1", "2_o1", "3_o1") row.names(df) <- names(df) indx <- gsub(".*_", "", names(df)) I can split the dataframe by the index that is given in the column.nam