df_transform | R Documentation |
Change the projection of x and y values (spatial coordinates) of a data.frame, make sure your data only includes x,y and z and no additional categorical variables
df_transform(data, coords, crs.in, crs.out)
data |
data.frame object |
coords |
vector of the two coordinate column names |
crs.in |
original projection of data.frame, standard is WGS1984. |
crs.out |
output projection of data.frame, which is returned. |
df_transform internally converts the data.frame into a spatial object, than transforms the projection of the data and converts the final spatial object back into a data.frme.
A data.frame
data(meuse, package="sp") meuse <- df_transform(meuse, crs.in=sp::CRS("+init=epsg:28992"), crs.out=sp::CRS("+init=epsg:4326"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.