R CMD check NOTEs conflicting with tidyverse recommendation?

I am trying to prepare my first package for a CRAN submission and have been running devtools::check() on all recent updates.

As I was getting a lot of NOTEs about functions that had 'no visible binding for global variable 'xyz'', and this referred to notation in which I was using dplyr functions to transform data by referring to the variable names directly. So I changed all these from the dplyr::filter(species) notation to dplyr::filter(.data$species) notation.

However, then I started noticing warnings when I run these functions, saying that this method is outdated, and I should be referring to the variable names directly.
ie
'Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0.
:information_source: Please use "species" instead of .data$species '
..which I now also notice suggests that I should actually be using the variable name within quotes?

Simple question: what is the best course of action that satisfies both issues?

That how I understand it: The message Please use "Species" instead of .data$Species suggests that you should enclose the variable name in quotes in tidyselect functions. I've used utils::globalVariables() when using unquoted variable names in expressions. It works to suppress the note from the R CMD check, but I honestly don't know if this is a "best practice".

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.