Learn R Programming

datapackage (version 0.2.1)

dp_to_yearmonth: Convert a vector to 'yearmonth' using the specified field descriptor

Description

Convert a vector to 'yearmonth' using the specified field descriptor

Usage

dp_to_yearmonth(x, fielddescriptor = list(), ...)

Value

Will return an Date vector with fielddescriptor added as the 'fielddescriptor' attribute. The dates will be the first of the given month. Therefore, a 'yearmonth' "2024-05" is translated to a date "2024-05-01".

Arguments

x

the vector to convert.

fielddescriptor

the field descriptor for the field.

...

passed on to other methods.

Details

When fielddescriptor is missing a default field descriptor is generated.

Valid formats are "YYYY-MM" or "YYYYMM". When x is numeric or integer, it is assumed that it was a yearmonth in the format "YYYYMM" that was accidentally converted to numeric format.