dataQC.dateCheck: find and standardize dates 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 for a column with dates and transforms them to the YYYY-MM-DD format.

Usage

1
dataQC.dateCheck(dataset, date.colnames)

Arguments

dataset

dataframe. The dataset where the date column should be found

date.colnames

character vector. a list of potential names for the column with the date. e.g. c("date", "Date", "collection date")

Details

The date column is found based on a user-provided list of possible names to look for (data.colnames argument). If a columnname is found that corresponds to a term in the list, the dates will be convered to the YYYY-MM-DD format, if the original format can be recognized.

Value

a list of length 2, with "$values" a vactor with the same number of rows as the dataset argument containing the corrected date values, 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.LatitudeLongitudeCheck(), dataQC.TaxonListFromData(), dataQC.TermsCheck(), dataQC.completeTaxaNamesFromRegistery(), 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
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.dateCheck(dataset=test_metadata, date.colnames=c("collection_date"))

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