powered by
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, ...)
# 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, ...)
any of the following:
a matrix: Either a matrix with named longitude and latitude columns or an unnamed two column matrix containing longitude and latitude (in that order)
matrix
longitude
latitude
a data.frame with named longitude and latitude columns
data.frame
an sf::sfc_POINT object
a named or unnamed numeric vector of length 2 containing a single longitude-latitude coordinate pair
numeric
a character scalar path or URL to a shapefile or zipped shapefile
character
ignored
an sf::sf data.frame
# NOT RUN { smart_as_sf(data.frame(lat = c(1,2,3), longitude = c(3,4,5))) smart_as_sf(c(1, 2)) # }
Run the code above in your browser using DataLab