You have two solutions:
Rewrite your code to avoid non-standard evaluation. For ggplot2, this means using aes_string()
instead of aes()
(as described by Harlan)
Add a call to globalVariables(c("x.values", "y.values"))
somewhere in the top-level of your package.
You should strive for 0 NOTES in your package when submitting to CRAN, even if you have to do something slightly hacky. This makes life easier for CRAN, and easier for you.
(Updated 2014-12-31 to reflect my latest thoughts on this)
Have you tried with aes_string
instead of aes
? This should work, although I haven't tried it:
aes_string(x = 'x.values', y = 'y.values')
This question has been asked and answered a while ago but just for your information, since version 2.1.0 there is another way to get around the notes: aes_(x=~x.values,y=~y.values).
In 2019, the best way to get around this is to use the .data
prefix from the rlang
package. This tells R to treat x.values
and y.values
as columns in a data.frame
(so it won't complain about undefined variables).
Note: This works best if you have predefined columns names that you know will exist in you data input
#' @importFrom rlang .data
my_func <- function(data) {
ggplot(data, aes(x = .data$x, y = .data$y))
}
If
getRversion() >= "3.1.0"
You can add a call at the top level of the package:
utils::suppressForeignCheck(c("x.values", "y.values"))
from:
help("suppressForeignCheck")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With