Raster package not working

I am currently running a code which I have been sent to run a PCA test on 19 bioclimatic variables and 17 species. However every time I run the section to read in the climate data it says

Error in match.fun(FUN) : object 'raster' not found

I have tried multiple things such as making sure raster, Rcpp, rdgal are all installed. I have put the line of script below. Please let me know if you need to see anymore of the script.

bg <- lapply(list.files(path="Historical_climate/wc2", pattern="*.tif$", full.names = T), raster)

I just don't understand what is going wrong and why it isn't working. When I ran it the first time it didn't work, the second time it did work and the third time it didn't work. On the second time I didn't do anything differently.

so they are installed (install.packages)
but are they loaded in the session ?
library() or require()

I will check and get back to you!

Thank you so much!! Not sure what that did but it works!!!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.