Closed spsanderson closed 8 months ago
Add and argument of .pivot_wide as a boolean (TRUE/FALSE) that will pivot the residuals wide if user desires it to.
.pivot_wide
TRUE
FALSE
Example:
> library(recipes, quietly = TRUE) > library(tidyAML) > > rec_obj <- recipe(mpg ~ ., data = mtcars) > > fr_tbl <- fast_regression(mtcars, rec_obj, .parsnip_eng = c("lm","glm"), + .parsnip_fns = "linear_reg") > > result <- extract_regression_residuals(fr_tbl) > > purrr::map(result, ~tidyr::pivot_longer( + data = .x, + cols = -.model_type + )) [[1]] # A tibble: 96 × 3 .model_type name value <chr> <chr> <dbl> 1 lm - linear_reg .actual 21 2 lm - linear_reg .predicted 16.6 3 lm - linear_reg .resid 4.42 4 lm - linear_reg .actual 21 5 lm - linear_reg .predicted 14.2 6 lm - linear_reg .resid 6.82 7 lm - linear_reg .actual 22.8 8 lm - linear_reg .predicted 24.2 9 lm - linear_reg .resid -1.37 10 lm - linear_reg .actual 21.4 # ℹ 86 more rows # ℹ Use `print(n = ...)` to see more rows [[2]] # A tibble: 96 × 3 .model_type name value <chr> <chr> <dbl> 1 glm - linear_reg .actual 21 2 glm - linear_reg .predicted 16.6 3 glm - linear_reg .resid 4.42 4 glm - linear_reg .actual 21 5 glm - linear_reg .predicted 14.2 6 glm - linear_reg .resid 6.82 7 glm - linear_reg .actual 22.8 8 glm - linear_reg .predicted 24.2 9 glm - linear_reg .resid -1.37 10 glm - linear_reg .actual 21.4 # ℹ 86 more rows # ℹ Use `print(n = ...)` to see more rows
Add and argument of
.pivot_wide
as a boolean (TRUE
/FALSE
) that will pivot the residuals wide if user desires it to.Example: