data("mtcars") # load base R example dataset
# filter mtcars for mpg > 20
excl_neat(mtcars, mpg > 20)
# assign the same
mtcars_filtered = excl_neat(mtcars, mpg > 20)
# (mtcars_filtered now contains the filtered subset)
# return and assign excluded rows too
mtcars_filtered_plus_excluded = excl_neat(mtcars, mpg > 20, excluded = TRUE)
# print filtered data frame
print(mtcars_filtered_plus_excluded$filtered)
# print data frame with excluded rows
print(mtcars_filtered_plus_excluded$excluded)
# group printed count by cyl
excl_neat(mtcars, mpg > 20, group_by = 'cyl')
# sort output by grouping
excl_neat(mtcars, mpg > 20, group_by = 'cyl', sort_by = 'group')
# group by cyl amd carb
excl_neat(mtcars, mpg > 15, group_by = c('cyl', 'carb'))
# longer filter expression
excl_neat(mtcars, mpg > 15 & gear == 4, group_by = 'cyl',)
Run the code above in your browser using DataLab