I created a package to organise my files for an analysis workflow using {drake}. One function creates the Drake plan. This function is called in _drake.R
to run the analysis with r_make()
. So far so good everything works, I can change some paths and arguments in the function arguments and it creates a new plan to run.
Here is an example code
library(drake)
library(readr)
test_fn_plan <- function(paths, countries) {
drake_plan(
data = target(
read_tsv(file_in(path)),
transform = map(path = !!paths, country = !!countries, .id = country)
)
)
}
test_fn_plan(
c("path/to/data_IE.tsv", "path/to/data_UK.tsv"),
c("Ireland", "United Kingdom")
)
#> # A tibble: 2 x 2
#> target command
#> <chr> <expr>
#> 1 data_Ireland read_tsv(file_in("path/to/data_IE.tsv"))
#> 2 data_United.Kingdom read_tsv(file_in("path/to/data_UK.tsv"))
Created on 2019-10-29 by the reprex package (v0.3.0)
The problem comes from devtools::check()
. The plan steps are considered as global variables, undefined global variables, and I don't know how to handle them.
I get the following warnings (dozens on my actual code)
test_fn_plan: no visible binding for global variable ‘path’
test_fn_plan: no visible binding for global variable ‘country’
I already fixed all the other undefined global variables with rlang's .data$
pronoun. I am left with these warnings and I don't know what to do (except living with it).