i try to add a space into a layername of a rasterstack
names(predstack)[[1]] <- "MSR670 max"
> names(predstack)[[1]]
[1] "MSR670.max"
I know this is stupid, but i calculated a model which took 7 days for calculation. Unfortunaly one name of the model variables contains a space in the name. Now i want predict on the stack and that is not working, because the following Error appears:
> Prediction2model <- raster::predict(predstack, var2model)
Error in predict.randomForest(modelFit, newdata) :
variables in the training data missing in newdata
> names(predstack)
[1] "MSR670.max" "GLI201809_means"
[3] "MSR670201809_sd" "MVI201805_max"
> var2model$selectedvars
[1] "MSR670 max" "GLI201809_means"
[3] "MSR670201809_sd" "MVI201805_max"
So my Question is: How is it possible to add a space character to a raster layer name? Or is it possible to change the variable name in the random forest model afterwards?
Thank you for any ideas!