Nonstandard evaluation

  • Functions like dplyr::filter use nonstandard evaluation, and quote some of their arguments to help make code more tidy.
# `cyl` is written as a bare name--a symbol defined in the global environment
# but `cyl` only exists in the data frame "environment"
# so, `{dplyr}` quotes the argument
dplyr::filter(mtcars, cyl == 4)
  • You often can detect this if the argument wouldn’t work in isolation, for example:
library(MASS) # this is fine
MASS 
#> Error: object MASS not found

and

cyl 
#> Error: object 'cyl' not found