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

augment() fails #1192

Closed
USMortality opened this issue Mar 12, 2024 · 3 comments
Closed

augment() fails #1192

USMortality opened this issue Mar 12, 2024 · 3 comments

Comments

@USMortality
Copy link

USMortality commented Mar 12, 2024

The problem

augment() fails. Not sure why, this is a pretty simple example...

Reproducible example

library(fable)
library(tsibble)
library(dplyr)

x <- 2015:2021
y <- c(878.6, 866.4, 864.9, 1017.8, 1029.5, 961.5, 896.2)

df_bl <- tibble(x = x, y = y) |> as_tsibble(index = x)
# Split data into training and test
df_train <- df_bl |> filter(x <= 2019)
df_test <- df_bl |> filter(x > 2019)

df_train |>
  as_tsibble(index = x) |>
  model(TSLM(y ~ trend())) |>
  broom::augment()
Error in `mutate()`:
ℹ In argument: `dplyr::across(...)`.
Caused by error in `across()`:
! Can't compute column `TSLM(y ~ trend())`.
Caused by error in `mutate()`:
ℹ In argument: `.fitted = fitted(x, ...)[[".fitted"]]`.
Caused by error in `object$fitted`:
! $ operator is invalid for atomic vectors
Run `rlang::last_trace()` to see where the error occurred.
@simonpcouch
Copy link
Collaborator

Thanks for the issue!

The object you've passed to augment() is a mbl_df. The fabletools package defines the augment() method for mbl_dfs; please file an issue there to have this troubleshooted.

@simonpcouch
Copy link
Collaborator

Ah, looks like you did file an issue there. Duplicate of tidyverts/fabletools#399.

Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants