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

View source: R/field_yearmonth.R

dp_to_yearmonthR Documentation

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(), ...)

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.

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".


djvanderlaan/datapackage documentation built on June 12, 2025, 2:44 a.m.