aldo_tapia aldo_tapia - 1 year ago 163
R Question

How to save raster data in R object format?

I don't know how to deal with

with raster data in R. I have understood that raster package open a connexion with the image file using
function, so it doesn't really open the file into R workspace.

I want to save my workspace (data.frame, list, raster, etc) with
function (or similar) and open it in a different computer. If I try to plot or process a raster object saved in a different computer, always have the same issue:

Error in .local(.Object, ...) :
`C:\path\to\file.tif' does not exist in the file system,
and is not recognised as a supported dataset name.

Is there a way to save a raster object (opened as external file) in R format? I don't mean raster format as tiff nor grid and others.

Answer Source

You can save rasters, like other R objects, using the save command.


On a different computer, you can load that file using


which will bring back the raster r in your workspace.

I have tried this across Windows and Linux and it never gives problems

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download