Reputation: 9809
I am trying to save a raster inside a package as .rda
file using usethis::use_data
.
But when I want to work with the raster on a different computer I am getting
Error in .local(.Object, ...) :
Is it possible to save a raster in a package?
Or do I have to pack the .tif
file in /inst/extdata
or a compressed zip, if it gets to big?
Upvotes: 2
Views: 320
Reputation: 47101
This probably happens because the object points to a path/file that only exists on your computer. The best way to go is what you suggest, with the inst/extdata
route. Alternatively, you can force all values to memory before you save the object. E.g. by multiplying the object with 1. That will not work for large data-sets, as the package will in that case use a temporary file.
Upvotes: 2