Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming Conflict in as_tsibble() Results in Unsupported Index Error #284

Closed
jimmyrigby94 opened this issue Aug 12, 2022 · 1 comment
Closed

Comments

@jimmyrigby94
Copy link

jimmyrigby94 commented Aug 12, 2022

Details

When a data frame is passed to as_tsibble() with a column named index the object conversion fails.


Consider the following example, where the grouping variable is stored as "index", the time variable stored as "qtr", and the time series value named "value".

tbl2 <- tibble(
    qtr = rep(yearquarter("2010 Q1") + 0:9, 3),
    index = rep(c("x", "y", "z"), each = 10),
    value = rnorm(30)
)

as_tsibble(tbl2, key = index, index = qtr)

Results:

Error in `validate_index()`:
! Unsupported index type: character

Eliminating naming conflicts with specials fixes the error.

tbl2_conf <- tbl2%>%
      rename(grp = index)

as_tsibble(tbl2_conf , key = grp, index = qtr)
@earowang
Copy link
Member

earowang commented Oct 8, 2022

Thanks for reporting the issue and providing a reproducible example. Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants