Closed mwpennell closed 9 years ago
tl;dr I think you want mutate_
not mutate
Yeah, many functions Hadley writes use non-standard evaluation as a way of
giving the user a slightly more concise input (e.g. not quoting variable
names). This results in syntax that easily confuses R (e.g. is
resolved_name
a string or a variable containing a string?) and Hadley
recommends against using this syntax when writing packages. All of the
dplyr functions include an equivalent version of the function using
standard evaluation syntax. The standard evaluation version is just the
original version with an underscore at the end. See
http://cran.r-project.org/web/packages/dplyr/vignettes/nse.html for a
proper explanation.
p.s. this stuff still confuses me too.
On Tue Dec 16 2014 at 12:34:58 PM Matt Pennell notifications@github.com wrote:
I am using some dplyr in some functions and am using variables within a function in a few places. e.g.:
add_binomial <- function(df) df %>% rowwise() %>% mutate(resolved_binomial = short_species_name(resolved_name))
R CMD check throws a note:
add_binomial: no visible binding for global variable ‘resolved_name’
is this going to be a problem for CRAN? Is this good coding practice. This seems like a recurring issue in the hadleyverse
— Reply to this email directly or view it on GitHub https://github.com/ropensci/chromer/issues/16.
Alright. Thanks -- this is weird, but it is now fixed (I think).
I am using some dplyr in some functions and am using variables within a function in a few places. e.g.:
R CMD check throws a note:
is this going to be a problem for CRAN? Is this good coding practice. This seems like a recurring issue in the hadleyverse