Description Usage Arguments Details Author(s)
Convert a data.frame to SpatialPointsDataFrame by automatically identifying the columns that contain coordinate information (unless specified in a parameter), and assuming a lat-lon pseudoprojection unless otherwise indicated.
1 |
data |
An object coercible into a data.frame |
crs |
The proj4string argument for SpatialPointsDataFrame function. Defaults to WGS-84 lat-lon |
llcols |
Names of the longitude and latitude (x and y coordinate) columns, in that order. If missing, looks first for column names starting with latitude and longitude, then for column names starting with lat and lon, then with x and y (case insensitive). If any of the lookups result in one hit or more than two hits, or all lookups result in no hits, the function will fail. |
na.action |
What to do with missing or invalid values in coordinate columns |
Default behavior built into the function means that nine times out of ten, you can create your spatial object with a simple spdf(obj) call, instead of the standard sp:SpatialPointsDataFrame function call which requires three parameters. The function is also easy to use in magrittr pipe workflows. However, one time out of ten things could go horribly wrong if you're not careful!
Lauri Myllyvirta lauri.myllyvirta@greenpeace.org
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.