Displaying 2 results from an estimated 2 matches for "outputmat".
2018 Mar 29
0
Creating the right table from lapply list
Perhaps this toy example will help:
## example data
output <- list(1:5, 1:7, 1:4)
lens <- lapply(output, length)
maxlen <- max(unlist(lens))
outputmod <- lapply(output, function(x, maxl) c(x, rep(NA, maxl-length(x))), maxl=maxlen)
outputmat <- do.call(cbind, outputmod)
write.csv(outputmat, na='')
The idea is to pad the shorter vectors with NA (missing) before converting to a matrix structure.
I don't really need to know where the data came from, or that it's ncdf data, or how many months or years, etc. But I do ne...
2018 Mar 28
3
Creating the right table from lapply list
Hello,
I have no previous experience with R, but had to learn on the fly in the past couple of weeks. Basically, what I am trying to do is read a certain variable from a series of files and save it as csv-table. The variable has an hourly value for each month in a year for the past 20 years and has to be read for different geographical locations. So there will be 12 files per year (1 for each