count_val {cheapr} | R Documentation |
Count the number of occurrences of a value.
Description
This is a programmer's version of sum(x == value)
to count the number of
occurrences of a value without creating a potentially large logical vector.
Usage
count_val(x, value, recursive = TRUE)
val_count(x, value, recursive = TRUE)
which_val(x, value, invert = FALSE)
Arguments
x |
A vector, list, data frame or matrix. |
value |
A value with which to count the frequency of. |
recursive |
Should the function be applied recursively to lists? |
invert |
Should |
Details
This is a generalisation of num_na()
and as such the identity
count_val(x, NA) == num_na(x)
will always hold.
Value
A count of the number of times value
appears in x
.
[Package cheapr version 0.9.3 Index]