keep(iris, "Sepal.Length", "Sepal.Width")
keep(iris, qc(Sepal.Length, Sepal.Width)) # same result with non-standard eval
except(iris, "Species")
keep(iris, "Species", other) # move 'Species' to the first position
keep(iris, to("Petal.Width")) # keep all columns except 'Species'
except(iris, perl("^Petal")) # remove columns which names starts with 'Petal'
keep(airquality, (from("Ozone") & to("Wind"))) # keep columns from 'Ozone' to 'Wind'
# the same examples with infix operators
iris %keep% c("Sepal.Length", "Sepal.Width")
iris %keep% qc(Sepal.Length, Sepal.Width) # same result with non-standard eval
iris %except% "Species"
iris %keep% c("Species", other) # move 'Species' to the first position
iris %keep% to("Petal.Width") # keep all columns except 'Species'
iris %except% perl("^Petal") # remove columns which names starts with 'Petal'
airquality %keep% (from("Ozone") & to("Wind")) # keep columns from 'Ozone' to 'Wind'
Run the code above in your browser using DataLab