epiverse-trace / serofoi

Estimates the Force-of-Infection of a given pathogen from population based sero-prevalence studies
https://epiverse-trace.github.io/serofoi/
Other
17 stars 4 forks source link

No visible binding for global variable #103

Closed jamesmbaazam closed 1 year ago

jamesmbaazam commented 1 year ago

The devtools::check() monster strikes again with the following note. See this R-bloggers post on No visible binding for global variable for possible solutions. I think you're mostly encountering these notes with the tidyverse packages (data masking and tidyselect), so you could:

  1. Add @importFrom rlang .data to the roxygen2 tags of the culprit functions, then refer to the variables by .data$<name of variable> to remove this note. See this section on the dplyr website for tips.

  2. Declare the variables as NULL (arg1 <- arg2 <- NULL) on the top level of the functions before using them.

I'm happy to submit a PR as always. Do let me know.

>  devtools::check()
> checking R code for possible problems ... NOTE
  get_prev_expanded: no visible binding for global variable ‘age_mean_f’
  get_prev_expanded: no visible binding for global variable ‘prev_obs’
  get_prev_expanded: no visible binding for global variable
    ‘prev_obs_lower’
  get_prev_expanded: no visible binding for global variable
    ‘prev_obs_upper’
  get_prev_expanded: no visible binding for global variable ‘total’
  get_prev_expanded: no visible binding for global variable ‘counts’
  plot_foi: no visible binding for global variable ‘year’
  plot_foi: no visible binding for global variable ‘lower’
  plot_foi: no visible binding for global variable ‘upper’
  plot_foi: no visible binding for global variable ‘medianv’
  plot_info_table: no visible binding for global variable ‘y’
  plot_rhats: no visible binding for global variable ‘year’
  plot_rhats: no visible binding for global variable ‘rhat’
  plot_seroprev: no visible binding for global variable ‘age’
  plot_seroprev: no visible binding for global variable ‘p_obs_bin_l’
  plot_seroprev: no visible binding for global variable ‘p_obs_bin_u’
  plot_seroprev: no visible binding for global variable ‘p_obs_bin’
  plot_seroprev_fitted: no visible binding for global variable ‘age’
  plot_seroprev_fitted: no visible binding for global variable
    ‘predicted_prev_lower’
  plot_seroprev_fitted: no visible binding for global variable
    ‘predicted_prev_upper’
  plot_seroprev_fitted: no visible binding for global variable
    ‘predicted_prev’
  plot_seroprev_fitted: no visible binding for global variable
    ‘p_obs_bin_l’
  plot_seroprev_fitted: no visible binding for global variable
    ‘p_obs_bin_u’
  plot_seroprev_fitted: no visible binding for global variable
    ‘p_obs_bin’
  plot_seroprev_fitted: no visible binding for global variable ‘bin_size’
  prepare_bin_data: no visible binding for global variable ‘lower’
  prepare_bin_data: no visible binding for global variable ‘upper’
  prepare_serodata: no visible binding for global variable ‘age_min’
  prepare_serodata: no visible binding for global variable ‘age_max’
  prepare_serodata: no visible binding for global variable ‘total’
  prepare_serodata: no visible binding for global variable ‘PointEst’
  prepare_serodata: no visible binding for global variable ‘Lower’
  prepare_serodata: no visible binding for global variable ‘Upper’
  Undefined global functions or variables:
    Lower PointEst Upper age age_max age_mean_f age_min bin_size counts
    lower medianv p_obs_bin p_obs_bin_l p_obs_bin_u predicted_prev
    predicted_prev_lower predicted_prev_upper prev_obs prev_obs_lower
    prev_obs_upper rhat total upper y year
jpavlich commented 1 year ago

Since this is not a problem anymore I'm closing this