Closed EmilHvitfeldt closed 3 months ago
to close #1297 and close https://github.com/tidymodels/recipes/issues/1050.
The main problem was that knots wasn't passed through if it was set in options argument
knots
options
library(recipes) d <- tibble(x = seq(-2, 2, 0.01)) rec_res <- recipe(~., data = d) %>% step_ns(x, options = list(knots = seq(-1, 1, 0.125), Boundary.knots = c(-1.5, 1.5))) %>% prep() %>% bake(new_data = d) # -1 in `model.matrix()` to avoid intercept mm_res <- model.matrix(~splines::ns(x, knots = seq(-1, 1, 0.125), Boundary.knots = c(-1.5, 1.5)) - 1, data = d) attr(mm_res, "assign") <- NULL identical( rec_res, setNames(as_tibble(mm_res), names(rec_res)) ) #> [1] TRUE
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.
to close #1297 and close https://github.com/tidymodels/recipes/issues/1050.
The main problem was that
knots
wasn't passed through if it was set inoptions
argument