From below code, mutate.(matched = a %in% vector_b)
is in question.
library(tidytable)
df_a = data.frame(a = round(rnorm(2)))
df_b = data.frame(b = round(rnorm(2)))
vector_b = df_b |> pull.()
myfunction = function(df_matched, df_a, a, vector_b) {
df_matched = df_a |>
mutate.(matched = a %in% vector_b)
return(df_matched)
}
df_matched = myfunction(df_matched, df_a, b, vector_b)
df_matched |> count.(matched)
# A tidytable: 2 × 2
# matched N
# <lgl> <int>
#1 FALSE 1
#2 TRUE 1
I was just wondering if there is another way to achieve the same thing as mutate.(matched = a %in% vector_b)
without using %in%
.