Hi, and welcome!
Please see the FAQ: What's a reproducible example (`reprex`) and how do I create one? Using a reprex, complete with representative data will attract quicker and more answers.
Here, though, the last line has all the necessary information
could not find function "predict.gbm"
The code runs locally because the gbm
package was loaded via
library(gbm
which points to the likely conclusion that it is not provisioned on the Microsoft R Server. See this operalization post for a easy way of seeing if local and remote configurations are identically configured.