filterNumeric {iNZightTools}R Documentation

Filter data by levels of a numeric variables

Description

Filter a dataframe by some boolean condition of one numeric variable and returns the result along with tidyverse code used to generate it.

Usage

filterNumeric(.data, var, op, num)

Arguments

.data

a dataframe or survey design object to filter

var

character of the column in .data to filter by

op

a logical operator of "<=", "<", ">=", ">", "==" or "!=" for the boolean condition

num

a number for which the op applies to

Value

filtered dataframe with tidyverse code attached

Author(s)

Owen Jin, Tom Elliott

See Also

code

Examples

Run examples

filtered <- filterNumeric(iris, var = "Sepal.Length", op = "<=", num = 5)
cat(code(filtered))
head(filtered)

require(survey)
data(api)
svy <- svydesign(~dnum+snum, weights = ~pw, fpc = ~fpc1+fpc2, data = apiclus2)
(svy_filtered <- filterNumeric(svy, var = "api00", op = "<", num = 700))
cat(code(svy_filtered))


[Package iNZightTools version 1.12.2 Index]