Skip to contents

Count the number of times x appears in y

Usage

count_in(x, y)

Arguments

x

A vector

y

A vector of the same class/type as x

Value

A named vector where the names are the value of x that was found in y and the values are the number of times x was found in y

Examples

count_in(
  x = c(1, 2, 3, 3, 3, 4, 4),
  y = c(2, 2, 3, 3, 4)
)
#> y
#> 2 3 3 3 4 4 
#> 2 2 2 2 1 1