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.