This question is a continuation of the Number of days in a year .
I did what Dirk suggested with a huge data.frame. My commands look like this:
dateSeq <- function(df) {
res <- seq(as.Date(df["begin"]), as.Date(df["end"]), by = "1 day")
format(res, "%Y")
}
dataFrame$seq <- apply(dataFrame, 1, dateSeq)
dataFrame_years <- do.call("c", dataFrame[["seq"]])
rm(dataFrame)
gc()
gc()
dataFrame_tab <- table(dataFrame_years)
Now these commands fill my 8 gigabyte RAM and 2 GB. At the same time, my processor is bored, having a processor load of perhaps 15%.
In addition, it takes my computer age to fulfill my "desires." Can I transfer some of the work to the CPU and free up my Ram a bit?
source
share