Coerces Vector to a Given Time Class
See also
Other internal_time_handling:
utils_as_time()
,
utils_is_time()
,
utils_new_time()
,
utils_time_keywords()
,
utils_time_keywords_dictionary()
,
utils_time_keywords_translate()
,
utils_time_units()
Examples
x <- utils_coerce_time_class(
x = c("2024-01-01", "2024-02-01"),
to = "Date"
)
x
#> [1] "2024-01-01" "2024-02-01"
class(x)
#> [1] "Date"
x <- utils_coerce_time_class(
x = c("2024-01-01", "2024-02-01"),
to = "POSIXct"
)
x
#> [1] "2024-01-01 UTC" "2024-02-01 UTC"
class(x)
#> [1] "POSIXct" "POSIXt"
x <- utils_coerce_time_class(
x = c("2024-01-01", "2024-02-01"),
to = "numeric"
)
x
#> [1] 19723 19754
class(x)
#> [1] "numeric"