Skip to content

Commit

Permalink
Fix refit.mdl_df dropping lst_mdl class
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Mar 23, 2020
1 parent 60c34be commit cea91e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
22 changes: 11 additions & 11 deletions R/refit.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
#' @rdname refit
#' @export
refit.mdl_df <- function(object, new_data, ...){
object %>%
bind_new_data(new_data) %>%
gather(".model", ".fit", !!!syms(object%@%"models")) %>%
as_tibble %>%
transmute(
!!!key(object),
!!sym(".model"),
.fit = map2(!!sym(".fit"), !!sym("new_data"), refit, ...)
) %>%
spread(".model", ".fit") %>%
as_mable(key = key(object), models = object%@%"models")
mdls <- syms(object%@%"models")
new_data <- bind_new_data(object, new_data)

object %>%
dplyr::mutate_at(vars(!!!mdls),
refit, new_data[["new_data"]], ...)
}

#' @export
refit.lst_mdl <- function(object, new_data, ...){
`class<-`(map2(object, new_data, refit, ...), class(object))
}

#' @rdname refit
Expand Down
4 changes: 4 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ This submission resolves issues with a soon to be released version of tibble.
## revdep checks

All revdeps have been checked.

## Resubmission

Fix issue with revdep checks for fable.

0 comments on commit cea91e1

Please sign in to comment.