Some cleaning up of the PCA and random forest models code. Main changes:
loadPCAData() returns a list with all three PCA objects. TODO: consider breaking up PCAs by season. Or moving to modeling method avoiding PCA entirely. efdd524
All random forest model fitting and prediction code is in random-forest.R. More of the data checking and model fitting is wrapped in functions and then the last portion of the script runs through TMIN and TMAX models for the DM. There is still some code repetition, but adding other mtn ranges will not add as much code as it would have before. I also removed the training and testing data split because we have so few sensors. But we can add it back in easily and I left the splitdf() function.
The changes in 2), above, allow us to have fewer error-prone temporary variables such as "tmin2" and "tmin3" which are hard to keep track of.
Some cleaning up of the PCA and random forest models code. Main changes: