| as_coord_matrix {smartmap} | R Documentation |
Coerce an R object to a matrix of coordinates
Description
A coord_matrix is a matrix with two columns named "lon" and "lat" to
represent spatial point data. They are used as an intermediary when
converting some R objects to sf::sf() objects.
as_coord_matrix() can smartly convert a range of R objects to
coord_matrix. If you are a package developer and want to add support
for smartmap to your package without having to depend on the heavy sf
package, it is enough to provide an as_coord_matrix() method.
Usage
as_coord_matrix(x, ...)
## Default S3 method:
as_coord_matrix(x, ...)
## S3 method for class 'numeric'
as_coord_matrix(x, ...)
## S3 method for class 'sf'
as_coord_matrix(x, ...)
## S3 method for class 'sfc_POINT'
as_coord_matrix(x, ...)
## S3 method for class 'matrix'
as_coord_matrix(x, ..., loncol = guess_loncol(x), latcol = guess_latcol(x))
## S3 method for class 'data.frame'
as_coord_matrix(x, ..., loncol = guess_loncol(x), latcol = guess_latcol(x))
Arguments
x |
any of the following:
|
... |
passed on to methods |
loncol, latcol |
|
Value
as_coord_matrix() returns a coord_matrix object: A numeric
matrix with the columns "lon"and "lat" (in that order)
See Also
https://stackoverflow.com/questions/7309121/preferred-order-of-writing-latitude-longitude-tuples