dataQC.LatitudeLongitudeCheck: find and standardize geographic coordinates in a dataframe

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

View source: R/DataQC_Utils.R

Description

looks in the columns of a dataset (dataframe) for a column with coordinates and transforms them a standardized decimal format (see details).

Usage

1
2
dataQC.LatitudeLongitudeCheck(dataset, 
  latlon.colnames=list(c("lat_lon"),c("latitude"), c("longitude")))

Arguments

dataset

dataframe. The dataset where the date column should be found

latlon.colnames

a list of length 3 with character vectors. Three vectors of potential names for the columns with the latitude-longidude values. The first vector in the list are names if latitude and longitude were to be in the same column (e.g. the MIxS lat_lon format), the second and third are for when latitude and longitude, respectively, are in seperate columns. Example: list(c("lat_lon"), c("latitude"), c("longitude"))

Details

The date column is found based on a user-provided list of possible names to look for (latlon.colnames argument). First, a single column is searched where latitude and longitude are noted in a single field, if this returns no result, latitude and longitude are looked for in seperate fields. When found, the coordinates are transformed to decimals and returned as a single field, with values separated by a single space That is: (X Y), with X a numeric decimal latitude value and Y a numeric decimal longitude value.

Value

a list of length 2, with "$values" a vector of same length as the number of rows in the dataset argument, and "$warningmessages" a vector with potential warning messages as character strings.

Author(s)

Maxime Sweetlove CC-0 2019

See Also

Other quality control functions: dataQC.TaxonListFromData(), dataQC.TermsCheck(), dataQC.completeTaxaNamesFromRegistery(), dataQC.dateCheck(), dataQC.eventStructure(), dataQC.findNames(), dataQC.generate.footprintWKT(), dataQC.guess.env_package.from.data(), dataQC.taxaNames()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
test_metadata <- data.frame(sample_name=paste("sample", 1:5, sep="_"),
                            collection_date=c("2020-09-23", "2020", 
                                              "16 Jan. 2020", 
                                              "November 1998", 
                                              "12/01/1999"),
                           latitude=c(23, 45, -56.44, "47.5", "-88° 4\' 5\""),
                           longitude=c(24, -57, -107.55, "33.5", "-130° 26\' 9\""),
                           row.names=paste("sample", 1:5, sep="_"))
dataQC.LatitudeLongitudeCheck(dataset=test_metadata, 
                              latlon.colnames=list(c("lat_lon"),
                                                   c("latitude"), 
                                                   c("longitude")))

biodiversity-aq/OmicsMetaData documentation built on Dec. 19, 2021, 9:44 a.m.