as_reliable: Reliable conversion to another data type

as_reliableR Documentation

Reliable conversion to another data type

Description

Support functions for the convert function. These functions coerces vectors to a new data type, e.g. as.numeric except that it converts factors to character first. See convert for more information.

Usage

as_reliable_num(.x, ...)

as_reliable_int(.x, ...)

as_reliable_lgl(.x, ...)

as_reliable_dte(.x, origin = "1970-01-01", ...)

as_reliable_dtm(.x, origin = "1970-01-01", tz = "UTC", ...)

as_reliable_int(.x, ...)

as_reliable_lgl(.x, ...)

as_reliable_dte(.x, origin = "1970-01-01", ...)

as_reliable_dtm(.x, origin = "1970-01-01", tz = "UTC", ...)

Arguments

.x

vector

...

additional arguments

origin

argument to set origin for date/date time.

tz

argument to set time zone for date/date time. Default is UTC.

Value

vector

See Also

vignette("convert"), vignette("hablar")

Examples

x <- as.factor(c("1", "3.5"))
as_reliable_num(x)

x <- as.factor(c("9", "7"))
as_reliable_int(x)

x <- as.factor(c("1", "0"))
as_reliable_lgl(x)


hablar documentation built on March 31, 2023, 11:54 p.m.