Filter a data frame for the top quantile of a specified variable.
Arguments
- df
A data.frame.
- var_field
A character string indicating the name of the variable used for filtering.
- probs
A numerical value between 0 and 1 (i.e. proportion) indicating the quantile threshold used for filtering.
Value
A data.frame, containing all rows for which the specified variable greater or equal the specified threshold.
Examples
df <- data.frame(a = rnorm(10), b = sample(letters, 10, replace = TRUE))
filter_ntile(df, "a", .75)
#> a b
#> 4 0.7383247 y
#> 5 0.5757814 l
#> 7 1.5117812 a