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

audit use of ... in package #1271

Open
EmilHvitfeldt opened this issue Nov 30, 2023 · 1 comment
Open

audit use of ... in package #1271

EmilHvitfeldt opened this issue Nov 30, 2023 · 1 comment
Labels
documentation feature a feature request or enhancement

Comments

@EmilHvitfeldt
Copy link
Member

The ... are used throughout the package for different things.

Many of the steps define them themselves where it would probably be better if they were to be inherited.

Other functions such as prep() says ... aren't used, and should probably be checked as I suspect that some people are using prep(data = ddd) instead of prep(training = ddd)

@EmilHvitfeldt EmilHvitfeldt added feature a feature request or enhancement documentation labels Nov 30, 2023
@EmilHvitfeldt
Copy link
Member Author

library(tidyverse)
library(recipes)

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


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\\{\\.\\.\\.\\}\\{.*?\\item") |>
    str_remove("\\item\\{\\.\\.\\.\\}\\{") |>
    str_remove("\\} *\\\\item")
}

dots <- tibble(
  name = steps
) |>
  mutate(doc = map_chr(name, get_doc)) |>
  filter(str_detect(name, "impute$", negate = TRUE)) 

dots |>
  count(doc) |>
  pull(doc)

dots |>
  filter(is.na(doc))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant