BAAQMD / BAAQMD/tbltools

Fix all `no visible global function definition for` NOTEs in R CMD CHECK

Open
#21 7 comments 0 reactions 0 assignees View on GitHub
check
Dominant language
R
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

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](https://github.com/BAAQMD/tbltools/pulls). 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:
1. decide which package's function you want to use
2. Add the following roxygen2 annotation to the top of the function `#' @importFrom `

For reference, in the case of the `data_frame` example above, here is what I see when I type `??data_frame`:
Screen Shot 2021-04-09 at 9 35 27 AM
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`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running R CMD CHECK and reviewing the existing PR and comment thread to collect every “no visible global function definition” NOTE. For each reported function, inspect its uses in tbltools, including extract_tree and exact_tree, decide which package implementation is intended, and add the corresponding roxygen2 @importFrom annotation. Done means R CMD CHECK no longer reports these NOTES and the package uses consistent function definitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.