wp_date: Package specific 'as.Date()' function

Description Usage Arguments Methods (by class)

Description

wp_date() provides a generic function and several methods to transform something into a date, just like as.Date() from the base package. While most methods were copied 1:1 from as.Date() some changes were made that alter the usual behavior: (1) Whenever wp_date() is applied to an empty string "" or any other not-standard-unambiguous format the function will return NA and throw out a warning instead of simply kill itself with an error. (2) Whenever, as.Date usually is in the need of an origin supplied and does not get one wp_date() will assume the origin to be "1970-01-01" and throw an error instead of kill itself with an error. All these changes are made with the special purpose to make wp_trend() also with dirty, unreasonable data (e.g. "" or "2012-13-01" or "2012-02-32") and are not recommended for any other than wikipediatrend internal use.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
wp_date(x, ...)

## S3 method for class 'character'
wp_date(x, format = "", ...)

## Default S3 method:
wp_date(x, ...)

## S3 method for class 'numeric'
wp_date(x, origin, ...)

## S3 method for class 'factor'
wp_date(x, ...)

## S3 method for class 'POSIXct'
wp_date(x, tz = "UTC", ...)

## S3 method for class 'POSIXlt'
wp_date(x, ...)

Arguments

x

See ?as.Date

...

See ?as.Date

format

See ?as.Date

origin

See ?as.Date

tz

See ?as.Date

Methods (by class)


petermeissner/statsgrokse documentation built on May 25, 2019, 2 a.m.