cs_projectXY: Project Data

View source: R/spatial.R

cs_projectXYR Documentation

Project Data

Description

cs_projectXY converts STLMPD data into a simple features object using the XCoord and YCoord columns.

Usage

cs_projectXY(.data, varX, varY, crs)

Arguments

.data

A tibble or data frame

varX

Name of column containing x coordinate data

varY

Name of column containing y coordinate data

crs

integer with the EPSG code, or character with proj4string representing the coordinate reference system

Value

A sf object with the crime data projected for mapping.

Examples

# load example data
testData <- january2018

# identify missing x and y coordinates
testData <- cs_missingXY(testData, varX = x_coord, varY = y_coord, newVar = missingXY)

# subset to remove missing data
testData <- dplyr::filter(testData, missingXY == FALSE)

# project data
testData_sf <- cs_projectXY(testData, varX = x_coord, varY = y_coord)

# project data and transform to new CRS
testData_sf <- cs_projectXY(testData, varX = x_coord, varY = y_coord, crs = 4269)


chris-prener/compStatR documentation built on Jan. 25, 2024, 10:03 p.m.