standardize_dates: Convert dates in various formats to Date format

View source: R/standardize_dates.R

standardize_datesR Documentation

Convert dates in various formats to Date format

Description

This function is designed to convert dates from a mix of formats to standard "Date" format. It can handle dates in POSIX, numeric, Date, or mixed character format.

Usage

standardize_dates(x, origin = "1899-12-30", tz = Sys.timezone())

Arguments

x

vector, the date data to be converted

origin

character, the base date for numeric date format, in the form "YYYY-MM-DD". Defaults to "1899-12-30".

tz

character, the time zone to be used if converting from POSIX formats. Defaults to PDT, as this package was written for use in a Seattle-based analysis group, and PDT covers more of the year than PST. This affects both the assumed time zone for any dates in character class with "YYYY-MM-DD hh:mm:ss" format, and the time zone used when converting from dateTime format to date alone.

Value

A vector of the same length as x


mjdufort/miscHelpers documentation built on Feb. 4, 2024, 7:44 p.m.