I am having problems recovering lubridate::intervals when reading back from csv, and fst formats.
Does anyone have a suggestion for how to do this?
library(tidyverse)
library(fst)
library(lubridate)
test <- tibble(
start = ymd_hms("2020-01-01 12:13:14", tz="UTC"),
end = ymd_hms("2021-01-01 12:13:14", tz="UTC"),
interval = lubridate::interval(start, end)
) %>%
write_csv("test1.csv")
test %>% fst::write_fst("test1.fst")
str(test)
test_read_back_csv <- read_csv("test1.csv")
str(test_read_back_csv)
test_read_back_fst <- read_fst("test1.fst")
str(test_read_back_fst)
You will see that the structure of the returned object test_read_back_csv$interval or test_read_back_fst$interval is not a lubridate interval, and I both need to save this file, and read it back properly.
Save to a binary format such as
.RDS
:Created on 2022-03-14 by the reprex package (v2.0.1)