I am downloading tree cover spatial data using the 'dataverse' package and attempting to save it as a RasterStack. The download is fine, however when I use writeRaster to save it, I get the following error message: "Error in .local(.Object, ...) :"
I set it up as a function to ideally download and save each year. I've reviewed many forums, but none of the fixes applied have worked. I've been able to save other, test RasterStacks with the writeRaster function, but not mine. Any idea what the issue is?
library(dataverse)
library(raster)
setwd("C:/Users/Kate/Documents/ScottRiver/ShastaScottStateOfBasin/Data/Dataverse/")
downloaddataverse <- function(year){
thedf <-
get_dataframe_by_name(
filename = paste0("ARD_h02v06_C2_",year,"_vegCover.tif"),
dataset = "10.7910/DVN/KMBYYM",
server = "dataverse.harvard.edu",
.f = raster,
original=T)
}
df1990 <- stack(downloaddataverse(1990))
writeRaster(df1990,"df1990.tif",overwrite=T)
rasteruses temp files (on some kind of drive) and memory (RAM) together... I know that in an example I had on my machine in RStudio, a large raster stack was classed as aLarge RasterStackrather thanFormal Class RasterStack; I don't know where the raster stack data actually are (memory, temp files, etc.) while R is thinking about them. - Michael Roswellraster::tmpDir()return? - Michael Roswell