Learn R Programming

RTest (version 1.2.6)

normalizeDate: Reformat a Date String

Description

This method reformats a date string for R packages as these can be very heterogenous defined in the DESCRIPTION files of packages.

Usage

normalizeDate(d, asDate = TRUE, months = c(jan = "january", feb =
  "februrary", mar = "march", apr = "april", may = "may", jun = "june", jul
  = "july", aug = "august", sep = "september", oct = "october", nov =
  "november", dec = "december"))

Arguments

d

(character) The date to be converted.

asDate

(boolean) Return as R "Date" representation (TRUE) or as character string (FALSE).

months

(object) The name of the year's month.

Value

(see Parameter asDate) Reformatted date.

See Also

as.Date

Examples

Run this code
# NOT RUN {
new_date <- normalizeDate("15.September.2018",FALSE)

stopifnot(new_date=="15.09.2018")

# }

Run the code above in your browser using DataLab