Re: [R] apply a function to a list of data frames

2015-05-26 Thread Stefano Sofia
Thank you for your help. Your explanations have been very useful. Stefano Da: Rui Barradas [ruipbarra...@sapo.pt] Inviato: venerdì 22 maggio 2015 20.26 A: Stefano Sofia; r-help@r-project.org Oggetto: Re: [R] apply a function to a list of data frames

Re: [R] apply a function to a list of data frames

2015-05-22 Thread Bert Gunter
Where is your code? I see no invocation of sapply. -- 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, May 22, 2015 at 11:02 AM, Stefano Sofia

Re: [R] apply a function to a list of data frames

2015-05-22 Thread Rui Barradas
Hello, You should change your function to accept only one argument, the data.frames, and then use lapply (not sapply). Something like the following. calc - function(dat) { bias_dmo_max - round(mean((dat$dmo_12-dat$Eonestep_12), na.rm=TRUE), digits=2) rmse_dmo_max -

[R] apply a function to a list of data frames

2015-05-22 Thread Stefano Sofia
Dear R-users, given a list of dataframes (like below reported), for each month I need to apply a function (called calc). The result should be written in a new list of data frames, one row for each month. I have been trying to use sapply, with no success. Could somebody help me in this? $df1