# NOT RUN {
1:4 %a% 5:6 # 1:6
1:4 %a% 4:5 # 1,2,3,4,4,5
1:4 %u% 4:5 # 1,2,3,4,5
1:6 %d% 5:6 # 1:4
# function as criterion
1:6 %d% greater(4) # 1:4
1:4 %i% 4:5 # 4
# with criteria functions
letters %i% (contains("a") | contains("z")) # a, z
letters %i% perl("[a-d]") # a,b,c,d
1:4 %e% 4:5 # 1, 2, 3, 5
1:2 %r% 2 # 1, 2, 1, 2
# %n_i%, %n_d%
# remove column Species
iris %n_d% "Species"
# leave only columns which names start with "Sepal"
iris %n_i% like("Sepal*")
# leave column "Species" and columns which names start with "Sepal"
iris %n_i% ("Species" | like("Sepal*"))
iris %n_i% or("Species", like("Sepal*")) # same result
# }
Run the code above in your browser using DataLab