Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mistake in documented default value of keep_original_cols #1314

Merged
merged 1 commit into from
May 24, 2024

Conversation

EmilHvitfeldt
Copy link
Member

to close #1276 and close #1267

library(tidyverse)
library(recipes)

steps <- ls(getNamespace("recipes")) |>
  stringr::str_subset("^step_") |>
  stringr::str_subset("_new$", negate = TRUE)


get_arg <- function(x) {
  res <- getFromNamespace(x, getNamespace("recipes"))
  res <- formals(res)
  res$keep_original_cols
}

get_doc <- function(x) {
  readLines(paste0("man/", x, ".Rd")) |>
    paste(collapse = " ") |>
    str_extract("\\item\\{keep_original_cols\\}\\{.*?\\item") |>
    str_remove("\\item\\{keep_original_cols\\}\\{") |>
    str_remove("\\} *\\\\item") |>
    str_remove(".*\\{") |>
    str_remove("\\}.*") |>
    as.logical()
}

tibble(
  name = steps
) |>
  mutate(default = purrr::map(steps, get_arg)) |>
  filter(lengths(default) > 0) |>
  mutate(default = unlist(default)) |>
  mutate(doc = map_lgl(name, get_doc)) |>
  filter(default != doc)

#> # A tibble: 10 × 3
#> name                      default doc  
#> <chr>                     <lgl>   <lgl>
#> 1 step_classdist          TRUE    FALSE
#> 2 step_classdist_shrunken TRUE    FALSE
#> 3 step_count              TRUE    FALSE
#> 4 step_depth              TRUE    FALSE
#> 5 step_geodist            TRUE    FALSE
#> 6 step_indicate_na        TRUE    FALSE
#> 7 step_interact           TRUE    FALSE
#> 8 step_lag                TRUE    FALSE
#> 9 step_regex              TRUE    FALSE
#> 10 step_window            TRUE    FALSE

@EmilHvitfeldt EmilHvitfeldt merged commit 54975ee into main May 24, 2024
9 checks passed
@EmilHvitfeldt EmilHvitfeldt deleted the keep_original_cols-doc-update branch May 24, 2024 20:47
Copy link

github-actions bot commented Jun 8, 2024

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

step_interact documentation is not correct step_lag() incorrect documentation
1 participant