I recently installed both R and R Studio (this to say everything is updated). And it is giving me a version error when I run the following:
library(raster)
The error is the following:
Loading required package: sp
Error: package or namespace load failed for ‘raster’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘terra’ 1.4-22 is being loaded, but >= 1.5.12 is required
I already ran "install.packages("raster",dependencies=T)" to install the packages, but the error has to do with the versions. Again, everything is up to date.
The update for {terra} to 1.5.12 from 1.4-22 was released on January 13 and it has been slow to appear as compiled binaries, which means that if you have not installed the tools to compile R packages (e.g., the Rtools4 software for Windows) it will not be possible to install 1.5.12 yet. The binaries for R 4.1 and 4.0 for Windows are not on CRAN. For macOS, they just appeared today.
Warning in install.packages :
package ‘Rtools’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
To work with rasters in R, we need two key packages, sp and raster . To install the raster package you can use install.packages('raster') . When you install the raster package, sp should also install. Also install the rgdal package install.packages('rgdal') . Among other things, rgdal will allow us to export rasters to GeoTIFF format.