'Running function on each observation at the tome
I have panel data with monthly mean temperatures at the province level for around 40 years and I am trying to run the following function:
dataSPEI2$PET<-thornthwaite(Tave = dataSPEI2$mean_temperaturec, lat = dataSPEI2$latitude, na.rm=TRUE)
which, however, yields the following error:
Error: cannot allocate vector of size 11.8 Gb
Therefore, I would like to run a loop to apply the function to one province at a time. Is there someone who might suggest how to implement this strategy?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
