Count the total values of x that are %in% the vector y.
count_in(x, y, na.rm = TRUE, ignore.case = FALSE)
Arguments
- x
A vector to check.
- y
A vector to compare against.
- na.rm
logical; Should NA be ignored?
- ignore.case
logical; if FALSE, the pattern matching is case
sensitive and if TRUE, case is ignored during matching.
Value
The sum of x present in y.
See also
Other counting wrappers:
count_diff(),
count_na(),
count_out(),
na_in(),
na_out(),
na_rep(),
prop_distinct(),
prop_in(),
prop_na(),
prop_out(),
what_in(),
what_out()
Examples
count_in(c("VT", "NH", "ZZ", "ME"), state.abb)
#> [1] 3