Count the number of occurences of some element.
count(x, elem)
# S3 method for Container
count(x, elem)
# S3 method for Set
count(x, elem)
any R
object.
element to counted.
integer
number of how many times elem
occurs in the object.
co = container("a", "b", "a", mean, mean)
count(co, "a")
#> [1] 2
count(co, mean)
#> [1] 2
count(co, "c")
#> [1] 0