cs_projectXY
converts STLMPD data into a simple
features object using the XCoord
and YCoord
columns.
cs_projectXY(.data, varX, varY, crs)
.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 |
A sf
object with the crime data projected for mapping.
# 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)