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

Renaming period in plance / overwrite create Error: Invalid period name: Jan #95

Closed
paulrougieux opened this issue Mar 13, 2020 · 2 comments

Comments

@paulrougieux
Copy link

I am trying to use gg_subseries on a tsibble. I noticed what appears to be a bug due to renaming in place. Here is a reproducible example.

# Create monthly data from the 
library(feasts)
# Create dates
period <- seq(as.Date("2000-01-01"), as.Date("2016-12-31"), by = "1 month")
# Create some random walk values
set.seed(4)
y <- cumsum(rnorm(length(period)))
df <- data_frame(period = period, 
                 y = y, 
                 country = "ZZ") %>% 
    # Convert period to a yearmonth object
    mutate(period = tsibble::yearmonth(period)) %>% 
    as_tsibble(key = country, index = period) 

df %>%
    gg_subseries(y)
# Error: Invalid period name: Jan

When I mutate the period variable to a new name, the error doesn't appear

df2 <- data_frame(period2 = period, 
                  y = y, 
                  country = "ZZ") %>%
    # Convert period to a yearmonth object
    mutate(period2 = tsibble::yearmonth(period2)) %>% 
    as_tsibble(key = country, index = period2) 

df2 %>%
    gg_subseries(y)
@earowang earowang transferred this issue from tidyverts/tsibble Mar 13, 2020
@mitchelloharawild
Copy link
Member

Thanks, should be fixed now.

@paulrougieux
Copy link
Author

paulrougieux commented Mar 15, 2020

Thank you,

Issue fixed in the reproducible example above after doing remotes::install_github("tidyverts/feasts").

* installing *source* package ‘feasts’ ...
[...]
* DONE (feasts)
sessionInfo()
[...]
other attached packages:
[1] feasts_0.1.2.9000 fabletools_0.1.2 

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