I have a dataframe containing the best predictors by their contribution to a model:

           var contrib
2  Pfallwinter  8.1141
15      Tofall 58.0000
23          ai  5.3573
26     radmean  7.9753
27   radseason  0.9027 

Every variable name is also a raster object. So, how can I make a raster stack with those variables? Like this:


I have tried to extracting the string character and using the do.call and eval functions but seems that isn't the correct way, because they can't call the object already saved.

1 Answer 1


You can use mget() to search for objects given a character vector.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.