Exports tsibble to csv correctly

export_with_safe_date(x, file)

Arguments

x

tibble or tsibble with date column

file

filename

Value

file exporting code

Details

Exports tsibble to csv correctly The problem is that simple rio::export will transform monthly dates into strange integers.

Examples

x = ts(1:10, frequency = 12, start = c(2000, 1)) x_tsi = tsibble::as_tsibble(x) x_tsi = dplyr::rename(x_tsi, date = index) export_with_safe_date(x_tsi, paste0(tempdir(), "/data.csv"))
#> [1] "/tmp/RtmpagsqaA/data.csv"