parse_dates {pkdata}R Documentation

Parse Date and Date-Time Variables

Description

Given a vector of dates or date-times, create Date or POSIXct variables.

Usage

parse_dates(x, tz = getOption("pkdata.tz", ""))

Arguments

x

character vector of dates or date-times

tz

character string; specifies the time zone to be used for the conversion. Defaults to the current time zone.

Details

parse_dates calls parse_date_time from the lubridate package. While parse_date_time accepts multiple date formats, parse_dates requires a consistent format.

Value

vector of Date or POSIXct objects

Author(s)

Cole Beck

Examples

x <- c("2014-01-15", "20140202")
parse_dates(x)
x <- c("2014-01-15 01:51", "20140202 04:35:18")
parse_dates(x)

[Package pkdata version 0.1.0 Index]