I have a huge set of data that I have distributed on a list (33 years of hourly precipitation data for South America). Every object of the list is an ff array of data (one array per year; I have to use the ff package to avoid running out of RAM). Then, I need to select certain hours of every year, that is, certain matrices of every array, and paste them together. With a normal list I would do this using lapply:
require (abind)
pp_hour <- list()
length(pp_hour) <- 24
# pp is the list that contains the data.
# pp[[i]] is an array of hourly data for the i year. It has 3 dimensions: longitude, latitude and time.
for (j in 0:23) { # with this loop I intend to select all the j-hours and paste them together
t_aux <- c(0:23) == j
pp_hour[[j+1]] <- abind( lapply( pp, "[", ,,t_aux))
}
This method doesn't work with the ff objects, I get the error:
Error in eval(expr, envir, enclos) : argument is missing, with no default
I see there is an ff variant of apply, ffapply, but no variant of lapply. Anyone knows any elegant workaround?