Hi Ista This works brilliantly and is so elegant!
Yes, i googled quite a while but did not come across do.call till now. Thanks again Bernard On 10 Apr 2015 22:46, "Ista Zahn" <istaz...@gmail.com> wrote: > Hi Bernard, > > Did you try searching for an answer? This question (minus the xts part > which I don't think will matter) has been asked and answered many times, > with > > do.call("rbind", foo) > > being a common answer. > > Best, > Ista > On Apr 10, 2015 5:35 PM, "B Dittmann" <bd10st...@googlemail.com> wrote: > >> Dear R users, >> >> hope you can point me in the right direction. I am stuck with the >> following >> problem. >> >> My function "f1" reads csv files, manipulates them into the right xts >> format and returns the output at the end. This works perfectly fine. Now, >> I >> need to run "f1" over a long list of various csv files, all of the same >> format, but different dates (or time stamps) which is guaranteed by >> design. >> All these individual results per each file I hope to combine into one xts >> or zoo object. >> >> I tried "lapply" as follows: >> >> # all csv files start with "z1": >> file.names <- list.files(pattern = "z1*", full.names = T, recursive = >> FALSE) >> >> # my function: >> f1 <- function(x, param){ >> # x: the csv file >> # param: some parameter for calculation >> # spits results out >> return(results) >> } >> >> res <- lapply(file.names, function(x){f1(x, param)}) >> >> I wrote the output to "res" and by subsetting res[1], res[2], ... I can >> retrieve the results of each individual csv file on which I applied my >> function "f1". >> >> How could I append or merge all individual results res[i] for my i csv >> files into one xts or zoo object? >> >> Many thanks in advance, >> >> Bernard >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.