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.
as_coord_matrix(x, ...) # S3 method for default as_coord_matrix(x, ...) # S3 method for numeric as_coord_matrix(x, ...) # S3 method for sf as_coord_matrix(x, ...) # S3 method for sfc_POINT as_coord_matrix(x, ...) # S3 method for matrix as_coord_matrix(x, ..., loncol = guess_loncol(x), latcol = guess_latcol(x)) # S3 method for data.frame as_coord_matrix(x, ..., loncol = guess_loncol(x), latcol = guess_latcol(x))
| x | any of the following:
|
|---|---|
| ... | passed on to methods |
| loncol, latcol |
|
as_coord_matrix() returns a coord_matrix object: A numeric
matrix with the columns "lon"and "lat" (in that order)