Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dplyr::filter nse
library(dplyr)
library(lazyeval)
Species <- "virginica"
# The Species variable is interpreted
# in the context of the data frame
iris %>%
filter_(Species == Species) %>%
nrow()
# 150
# The Species variable is interpreted
# in the context of the global environment
iris %>%
filter_(interp(~Species == which_species,
which_species = Species)) %>%
nrow()
# 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.