rr_apply_datatype: Apply registers-style datatypes to fields

Description Usage Arguments Examples

Description

Registers use their own datatypes. This function converts character vectors to the equivalent R datatypes, handling cardinality='n'.

Usage

1
rr_apply_datatype(x, datatype, cardinality = 1, apply_iso_8601 = TRUE)

Arguments

x

Character vector (a field of a register).

datatype

Name of the datatype to apply: currently one of "curie", "url", "datetime", "string", "integer", "text", and "point". Unrecognised datatypes will be returned as characters.

cardinality

Character, one of "1" and "n" to say whether each element of x contains multiple values separated by semicolons.

apply_iso_8601

Logical, whether to parse ISO8601 strings as datetimes with parsedate::parse_iso_8601(), otherwise leave as a string. Partial datetimes are parsed as the earliest possible datetime, e.g. "2018" becomes "2018-01-01 UTC".

Examples

1
rr_apply_datatype("2014-04", "datetime")

openregister/RegistersClientR documentation built on May 23, 2019, 9:03 p.m.