xy.project.na: Add projected coordinates to a dataframe which contains NAs

Description Usage Arguments Value Examples

View source: R/xy.project.na.R

Description

Function to change projection of a data.frame

Usage

1
function(dataframe,CRSold,CRSnew,xold,yold,xnew,ynew)

Arguments

dataframe

A data.frame containing coordinates with column names specified in xold and yold

CRSold

The current CRS projection, see example

CRSnew

The new CRS projection, see example

xold

name of column containing x-coordinate

yold

name of column containing y-coordinate

xnew

name of column of projected x-coordinate

ynew

name of column of projected y-coordinate

Value

The class of x is printed as a side-effect.

Examples

1
2
3
4
5
6
d<-data.frame(lon=c(3,4,NA,5),lat=c(51,NA,52,53))
xy.project.na(dataframe=d,
              CRSold="+proj=longlat +datum=WGS84",
              CRSnew="+proj=utm +zone=31 +ellps=WGS84 +datum=WGS84 +units=m +no_defs +towgs84=0,0,0",
              xold="lon",yold="lat",xnew="xutm",ynew="yutm")
              

geertaarts/habitat.model documentation built on March 11, 2021, 9:42 a.m.