Skip to content

Have st_write() return obj invisibly? #889

@mpjashby

Description

@mpjashby

It may be useful to have st_write() return the value of the first argument obj invisibly, so that it can be used within magrittr pipelines and be consistent with, for example, the readr::write_*() family. This would allow code such as:

some_sf_data %>%
  st_write("sf_data.gpkg") %>%
  rmapshaper::ms_simplify(keep = 0.1) %>% 
  st_write("sf_data_simplified.gpkg") %>%
  dplyr::glimpse()

Other use cases would include needing to export the same data in multiple formats, or exporting spatial data, removing the geometry column with st_set_geometry(NULL) and then saving the remaining non-spatial data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions