filter_num | R Documentation |
This function filters a dataframe or survey design object by applying a specified boolean condition to one of its numeric variables. The resulting filtered dataframe is returned, along with the tidyverse code used to generate it.
filter_num(data, var, op = c("<=", "<", ">=", ">", "==", "!="), num)
data |
A dataframe or survey design object to be filtered. |
var |
The name of the column in |
op |
A logical operator to apply for the filtering condition. Valid options are: "<=", "<", ">=", ">", "==", or "!=". |
num |
The numeric value for which the specified |
A filtered dataframe with the tidyverse code attached.
Owen Jin, Tom Elliott, Zhaoming Su
code
filtered <- filter_num(iris, var = "Sepal.Length", op = "<=", num = 5)
cat(code(filtered))
head(filtered)
library(survey)
data(api)
svy <- svydesign(~ dnum + snum,
weights = ~pw, fpc = ~ fpc1 + fpc2,
data = apiclus2
)
svy_filtered <- filter_num(svy, var = "api00", op = "<", num = 700)
cat(code(svy_filtered))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.