Skip to content

Conversation

EmilHvitfeldt
Copy link
Member

This PR makes augment() return tibbles even if the input data is just a data.frame

library(parsnip)

lm_spec <- linear_reg() %>%
  set_engine("lm")

lm_fit <- lm_spec %>% fit(mpg ~ ., data = mtcars)

class(mtcars)
#> [1] "data.frame"

augment(lm_fit, new_data = mtcars) %>% class()
#> [1] "tbl_df"     "tbl"        "data.frame"

Created on 2021-04-23 by the reprex package (v1.0.0)

To close #468

Copy link
Member

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @EmilHvitfeldt! 🙌

@juliasilge juliasilge merged commit c7e1010 into tidymodels:master Apr 26, 2021
@EmilHvitfeldt EmilHvitfeldt deleted the augment-tibble branch April 26, 2021 16:40
@github-actions
Copy link

This pull request 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 May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make augment() return tibbles to match predict()
2 participants