build_site() fails to render some examples

33 Views Asked by At

I am not entirely certain as to why this is occurring but when I run the build_site() function on my package some examples no longer render. For example:

library(recipes)
library(dplyr)
library(tidyr)

df <- Titanic |>
 as_tibble() |>
 uncount(n) |>
 mutate(across(everything(), as.factor))

rec_obj <- recipe(Survived ~ ., data = df)

fct_tbl <- fast_classification(
  .data = df,
  .rec_obj = rec_obj,
  .parsnip_eng = c("glm"))

fct_tbl

Gives the following error:

#> Error in dplyr::mutate(mod_fitted_tbl, pred_wflw = internal_make_wflw_predictions(mod_fitted_tbl,     splits_obj)): ℹ In argument: `pred_wflw =
#>   internal_make_wflw_predictions(mod_fitted_tbl, splits_obj)`.
#> Caused by error in `map2()`:
#> ℹ In index: 1.
#> Caused by error in `dplyr::filter()`:
#> ! object 'rec_obj' not found

fct_tbl
#> Error in eval(expr, envir, enclos): object 'fct_tbl' not found

But I can run it fine in the terminal like so:

> library(recipes)
> library(dplyr)
> library(tidyr)
> 
> df <- Titanic |>
+     as_tibble() |>
+     uncount(n) |>
+     mutate(across(everything(), as.factor))
> 
> rec_obj <- recipe(Survived ~ ., data = df)
> 
> fct_tbl <- fast_classification(
+     .data = df,
+     .rec_obj = rec_obj,
+     .parsnip_eng = c("glm"))
> 
> fct_tbl
# A tibble: 1 × 8
  .model_id .parsnip_engine .parsnip_mode  .parsnip_fns model_spec wflw       fitted_wflw pred_wflw
      <int> <chr>           <chr>          <chr>        <list>     <list>     <list>      <list>   
1         1 glm             classification logistic_reg <spec[+]>  <workflow> <workflow>  <tibble> 

The fast_classifiction() function comes from tidyAML library.

0

There are 0 best solutions below