Skip to content

Commit c7e1010

Browse files
authored
Merge pull request #478 from EmilHvitfeldt/augment-tibble
make augment() return tibbles
2 parents ecb2a8e + ab88353 commit c7e1010

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

R/augment.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ augment.model_fit <- function(x, new_data, ...) {
7777
} else {
7878
rlang::abort(paste("Unknown mode:", x$spec$mode))
7979
}
80-
new_data
80+
as_tibble(new_data)
8181
}

tests/testthat/test-augment.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ test_that('regression models', {
3535
)
3636
expect_equal(nrow(augment(reg_xy, head(mtcars[, -1]))), 6)
3737

38+
expect_s3_class(augment(reg_form, head(mtcars)), "tbl_df")
39+
3840
reg_form$spec$mode <- "depeche"
3941

4042
expect_error(augment(reg_form, head(mtcars[, -1])), "Unknown mode: depeche")

0 commit comments

Comments
 (0)