Description Usage Arguments Value Examples
cs_projectXY
converts STLMPD data into a simple
features object using the XCoord
and YCoord
columns.
1 | 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.