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

no visible binding for global variable 'wb' #14

Closed
ddsjoberg opened this issue Jan 15, 2023 · 5 comments
Closed

no visible binding for global variable 'wb' #14

ddsjoberg opened this issue Jan 15, 2023 · 5 comments
Assignees

Comments

@ddsjoberg
Copy link
Collaborator

I don't think I quite understand how these functions use the bare wb as a default argument? Can we update somehow to remove the note from R CMD Checks?

N  checking R code for possible problems (3.1s)
   add_labelled_sheet: no visible binding for global variable 'wb'
   labelled_sheet: no visible binding for global variable 'wb'
   Undefined global functions or variables:
     wb
@Meghansaha
Copy link
Contributor

addressed in #31, needs review @ddsjoberg.

@ddsjoberg
Copy link
Collaborator Author

The NOTE is due to the default argument add_labelled_sheet(wrkbk = wb): the object wb does not exist/not defined.

I would make the update something like this:

add_labelled_sheet <- function(data, sheet_name = NULL, wrkbk = NULL, start_row = 1L){
  wrkbk <-
    wrkbk %||%
    tryCatch(
      get("wb", envir = rlang::caller_env()),
      error = function(e) {
        paste(
          "The {.code wrkbk} argument has not been specified,",
          "and the default object {.field wb} does not exist in the calling environment."
        ) |>
          cli::cli_abort()
      }
    )

This update applies to both labelled_sheet() and add_labelled_sheet().

Let's also check-in with @shannonpileggi if this solution is amenable for her. We don't want to accidentally make a breaking change (although I don't think this will be one).

@Meghansaha
Copy link
Contributor

lol this was similar, but more elegant to what I was about to write, and yes we should consult with @shannonpileggi. If she's fine with this, I can implement it on my branch I created for this.

@ddsjoberg
Copy link
Collaborator Author

since it's a small update, go ahead and prepare the pull request and shannon can reivew

@ddsjoberg
Copy link
Collaborator Author

complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants