Converts R objects to sf::sf objects, but supports a wider range of input data than sf::st_as_sf.
smart_as_sf(x, ...) # S3 method for default smart_as_sf(x, ...) # S3 method for data.frame smart_as_sf(x, ...) # S3 method for character smart_as_sf(x, ...)
| x | any of the following:
|
|---|---|
| ... | ignored |
an sf::sf data.frame
smart_as_sf.default() looks if an sf::st_as_sf(),
sf::st_as_sfc() or as_coord_matrix() method exists for x (in
that order). If you are a package developer and want to support smartmap
for a custom S3 class in your package, it is enough to provide one of these
methods.
#> Simple feature collection with 3 features and 2 fields #> Geometry type: POINT #> Dimension: XY #> Bounding box: xmin: 3 ymin: 1 xmax: 5 ymax: 3 #> CRS: EPSG:4326 #> lat longitude geometry #> 1 1 3 POINT (3 1) #> 2 2 4 POINT (4 2) #> 3 3 5 POINT (5 3)#> Simple feature collection with 1 feature and 0 fields #> Geometry type: POINT #> Dimension: XY #> Bounding box: xmin: 1 ymin: 2 xmax: 1 ymax: 2 #> CRS: EPSG:4326 #> geometry #> 1 POINT (1 2)