coordinate_cleaning: Coordinate cleaning

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/coordinate_conversions.R

Description

The function converts coordinates in various formats in a single column to 2 columns, decimal degrees North East. Use UTF-8 encoding to read and modify the code of the function

Usage

1
2
3
4
5
6
coordinate_cleaning(
  coords,
  id,
  assume_good_order = TRUE,
  result_format = "complete"
)

Arguments

coords

a character vector containing longitude and latitude together. Either in sexadecimal or decimal degrees, latitude or longitude first, with or without a letter indicateing Northing and Easting.

id

a character of factor vector grouping coordinates belonging to the same study or article ie. coordinates sharing the same style,

assume_good_order

If there is no information (a letter indicating Northing and Easting), latitude is assumed to come before longitude. Default to TRUE.

result_format

If complete, the default, the function returns the table given by dmsparse with coordinates decomposed in degrees, minutes, seconds, decimal degrees and comments. If simple, only latitude and longitude are returned.

Details

The function uses regular expressions and parsing to split latitude and longitude values using different cues and prepares the coordinate strings to go through dmsparse. If coordinates are in a consistent format, dmsparse or dmsparsefmt can be used. If Latitude and Longitude are in different columns but format is messy, parse_lon_lat does the job too.

Value

data.frame. If result_format == 'simple': two columns, x and y with coordinates in decimal degrees East and North. If result_format == 'complete', coordinates are given with comments on errors found in initial values.

Author(s)

Alban Sagouis

See Also

dmsabs, dmsparse, quickclean, errorcheck, CoordinateCleaner. parse_lon_lat

Examples

1
2
3
4
load("data/coordinates_test_dataset_1")
coords <- dat$coord
id <- dat$study_ID
data.frame(dat, coordinate_cleaning(coords, id))

AlbanSagouis/iClean documentation built on May 14, 2020, 9:06 p.m.