dupe_thresh: Filters a Vector According to Number of Duplicates

Description Usage Arguments Details Value Author(s) References Examples

View source: R/dupe_thresh.R

Description

Filters a vector according to the number of duplicates in the vector, where the conditions for the acceptable number of duplicate values are specified.

Usage

1
dupe_thresh(invec, count)

Arguments

invec

The input vector.

count

The threshold for duplicates. See "Details".

Details

The "count" parameter can be either a single digit or a character vector showing the desired comparison to be used as the threshold (for example "> 5"). If no binary relational operator is specified, the relational operator used is >=.

Value

A vector.

Author(s)

Ananda Mahto

References

http://stackoverflow.com/q/29973061/1270695

Examples

1
2
3
4
5
6
7
8
set.seed(1)
x <- sample(letters[1:10], 35, TRUE)
sort(table(x))

table(dupe_thresh(x, 3))
table(dupe_thresh(x, "<3"))
table(dupe_thresh(x, "== 3"))
table(dupe_thresh(x, "!=3"))

mrdwab/SOfun documentation built on June 20, 2020, 6:15 p.m.