Open damianooldoni opened 1 week ago
A little code snippet to identify where adding .data
or using "col_name"
in tidyselect related functions (e.g. dplyr::select("col_name")
instead of dplyr::select(col_name)
):
package_name <- "b3gbi"
exported_functions <- getNamespaceExports(package_name)
globals <- purrr::map(exported_functions, ~ codetools::findGlobals(get(.x)))
globals
Ideally, this should only return base R functions and operators.
Hi 👋 Just a note about some globally imported functions.
I think you can remove (most of the)
@importFrom
lines (L5-L10) inb3gbi-package.R
.Via Ctrl+F (Mac: @ + F) you can easily detect where a function is used throughout the package. It seems that:
package::function()
is followed: no need to import globally via@importFrom
. Examples:readr::read_csv()
,purrr::map()
.plan()
andmultisession
fromfuture
package and the functionfuture_map()
fromfurrr
.Instead, I think you should add
#' @importFrom dplyr %>% .data
in order to use pipe%>%
and.data
. By importing%>%
you can deleteutils-pipe.R
. By adding.data
you can use it everywhere infilter()
,mutate()
orgroup_by()
. Example:dplyr::filter(.data$column)
. Why? It will solve a lot of notes about "global variable x not found"` while running R CMD CHECK.Please, let me know via this issue if I can help or get in contact with the B-Cubed devs community (see our #wp3-software-helpdesk Slack channel).