Skip to content

FR : add as.ts 'drop' argument #282

@arnaud-feldmann

Description

@arnaud-feldmann
library(tsibble)
tibble(value=1:12,key = "all", time = make_yearmonth(2000,1:12)) %>%
  as_tsibble(index = time, key = key) %>%
  as.ts
#>      Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
#> 2000   1   2   3   4   5   6   7   8   9  10  11  12

# Wanted : an arg to get this result

ts(matrix(1:12, dimnames = list(NULL, "all")), start = 2000, frequency = 12) %>%
  dput
#> structure(1:12, dim = c(12L, 1L), dimnames = list(NULL, "all"), tsp = c(2000, 
#> 2000.91666666667, 12), class = "ts")

Hi,
Would it be possible to add something something like a drop=FALSE arg to as.ts.tbl_ts that would always convert a tibble with a key to a mts ? I think that would allow smoother conversions.

Thanks,

Arnaud

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions