Consider the following S3 class:
stuff <- function(x, y) {
this <- x[[1]]
UseMethod("stuff")
}
stuff.foo <- function(x, y) {
this %in% y
}
stuff.bar <- function(x, y) {
names(this) %in% y
}
R CMD check complains that there is no visible binding for global variable ‘this’
.
Is there a way to pass this
across methods without making R unhappy and without declaring this
in the global environment?