Re: [R] Help needed on applying a function across different data sets and aggregating the results into a single data set

2010-01-01 Thread Girish A.R.
Thanks for the replies, Jim, David, and Dennis (who replied to me directly)! To summarize, here's what worked for me: === dflist <- list(df1, df2, df3) lsfun <- function(df) with(df, lsfit(A, B)$coef) res <- lapply(dflist, lsfun) do.call(rbind, res) === cheers, -Girish Girish

Re: [R] Help needed on applying a function across different data sets and aggregating the results into a single data set

2010-01-01 Thread David Winsemius
On Jan 1, 2010, at 10:34 PM, Girish A.R. wrote: Hi folks, Wish y'all a Happy New Year 2010! I need some help with the following: Say I have lots of data sets, on which I have to apply a certain function on the same set of columns in each of the data set. Let's take, for ex, the typical

Re: [R] Help needed on applying a function across different data sets and aggregating the results into a single data set

2010-01-01 Thread jim holtman
try this (and happy new year): DF <- cbind("df1","df2",...,"df100") result <- lapply(DF, function(.name){ lsfit(get(.name)$A, get(.name)$B) }) do.call(rbind, result) # put into matrix On Fri, Jan 1, 2010 at 10:34 PM, Girish A.R. wrote: > > Hi folks, > > Wish y'all a Happy New Year 2010!

[R] Help needed on applying a function across different data sets and aggregating the results into a single data set

2010-01-01 Thread Girish A.R.
Hi folks, Wish y'all a Happy New Year 2010! I need some help with the following: Say I have lots of data sets, on which I have to apply a certain function on the same set of columns in each of the data set. Let's take, for ex, the typical data set is: df1 <- as.data.frame(cbind(rnorm(10),rnorm