Install gbm package



Hi everyone,

I am new to R. I am trying to install the package gbm in R studio but I am getting the following message in the console:

Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&  : 
  missing value where TRUE/FALSE needed"

Can anyone please assist me.


did you try just install.packages("gbm")?

Can you post the code you used that gave you the error?


Thank you very much, I tried using install.packages(“gbm”) and it worked.

My other query is, I would like to use the gbm package and regression trees packages to model and predict land cover change (y) using predictor variables (x) such as distance to road, soil type, elevation, average rainfall and fire frequencies. Do you have any R scripts and suggestions as to how I can succesfully create this model and predict the land cover?



I have never worked with the package, but after a quick google search it looks like there are several vignettes for the package that will likely provide examples on how to use their package. The vignettes can be accessed by navigating to the package in the packages tab in RStudio.

If you have specific questions about code you have tried after working through the examples then you can ask them here then.


The caret documentation uses gbm in a lot of the worked examples. However, it uses it via the train function and not directly with gbm.