Closed nafreymueller closed 3 months ago
You do not show the version of "terra" you are using (what is printed when you do library(terra)
I am not sure if we can always trust the sessionInfo). But your example work fine for me with the CRAN and development version.
library(terra)
#terra 1.7.78
The type of problem you are having is almost always because you use RStudio. It can also be related to loading an old session. To work around that, open basic R and make sure the session is empty. If you get a message about loading a previous session, it is not. Also see ls()
(nothing should be printed). You can get rid of previous sessions by running unlink(".RData")
. If that all looks good, try install.packages("terra")
and run your code (all outside of RStudio).
Thanks for getting back to me so promptly! Yes I was using terra 1.7.78
. I was able to run everything in base R without issue.
It didn't seem to be related to any previous sessions being loaded (after running unlink(".RData")
and rm(list=ls())
. I weirdly have been getting the "One or more of the packages to be updated are currently loaded. Restarting R prior to install is highly recommended." notification when I try to update terra, even in a restarted RStudio session. So this does appear to be a RStudio-specific issue. Thanks!
There seem to multiple issues with RStudio with updating packages. One reason seems to be that it tries to load packages used in scripts as soon as you open the program. What you may need to do is to close all files, especially Rmd files if you have any, and then exit RStudio and start it again.
terra::plot()
is throwing an error for any kind of plot.When I try and plot even a basic raster:
I get this error:
I've tried updating R and RStudio, re-installing
Rcpp
, andterra
, and none of it seems to work.Any ideas?