-
Notifications
You must be signed in to change notification settings - Fork 0
Description
We should aim to have all the functions in tbltools produce the same results on different machines, regardless of what packages they have installed or loaded.
Currently when you run R CMD CHECK you get a lot of NOTEs like this:
extract_tree: no visible global function definition for ‘data_frame’
My understanding is that this message says "There is no global function for data_frame. So I will have to look". This is an issue because the same function can be defined by multiple packages. And if that is the case, I believe that R will simply choose the first one that it encounters. This means that the function can potentially give different results depending on which packages are loaded first.
This type of bug can be very hard to track down. Quite literally, the function might (harmlessly) be using a different version of the function that you intend right now. But in the next version of the package it could be modified, or removed (in which case the function uses a different package's version of the function).
I addresses some of these issues with my recent PR. But I will need to pair program with @dholstius in order to do the rest. (For example, some of the functions are multiply defined in data.table and dplyr. I've never used data.table myself, so I can't confidently say which version he intended to use in the code).
The solution to each of these NOTES is:
- decide which package's function you want to use
- Add the following roxygen2 annotation to the top of the function
#' @importFrom <package> <function>
For reference, in the case of the data_frame example above, here is what I see when I type ??data_frame:

It appears that data_frame is defined in at least 3 packages (tibble, vctrs and rcmdcheck). We should define which version we want R to use in exact_tree.