df_transform: Transform projection of data.frame

View source: R/df_transform.R

df_transformR Documentation

Transform projection of data.frame

Description

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

Usage

df_transform(data, coords, crs.in, crs.out)

Arguments

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.

Details

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.

Value

A data.frame

Examples

data(meuse, package="sp")
meuse <- df_transform(meuse, 
                      crs.in=sp::CRS("+init=epsg:28992"), 
                      crs.out=sp::CRS("+init=epsg:4326"))


RS-eco/ggmap2 documentation built on Dec. 7, 2022, 2:02 a.m.