[R] Extract particular months from List in R
ligges at statistik.tu-dortmund.de
Sun Aug 3 22:12:21 CEST 2014
On 03.08.2014 21:23, Zilefac Elvis wrote:
> Hi Uwe,
> Thanks for replying.
> Here is a reproducible example.
> I would like to extract data for the Months of c(6,7,8).
> Output files should have the same number of columns as input files.
If your data is in an object "dat", then:
lapply(dat, function(x) x[x[["Month"]] %in% 6:8,])
or in order to combine into one data.frame:
do.call("rbind", lapply(dat, function(x) x[x[["Month"]] %in% 6:8,]))
More information about the R-help