1

This may be an incredibly dumb question, but I have not been able to find an answer despite my best efforts.

I appreciate having data in sf format, but I no idea how to save it outside my current R session. And I tend to run into annoying issues when I save my data as a .shp or a .gpkg when importing back into R.

So, do sf objects have a .RData equivalent?

While I know this is wrong, I imagine it would look somethin like this...

st_write(nc, paste0(tempdir(), "/", "nc.sf"))

Thanks for the help!

k6adams
  • 406
  • 1
  • 3
  • 12
  • 2
    Why can you not save the data directly with `save(nc, file = "MyAmazingSFData.Rdata")`? – Ian Campbell Jan 06 '21 at 17:26
  • 3
    Have you tried `saveRDS()`? – jay.sf Jan 06 '21 at 17:38
  • 2
    @IanCampbell @jay.sf OMG, I knew there was a simple answer I was missing. I guess I assumed that if I saved as an `.RData`, that it would save as a `data.frame` and I would lose my geometry information. `save()` works. I assume `saveRDS` works too. Thank you! – k6adams Jan 06 '21 at 17:43

0 Answers0