# NOT RUN {
get_binary_score(
x = c(1:4, NA, ""),
answer = 3
)
# [1] 0 0 1 0 NA 0
get_binary_score(
x = c("20 minutes", "30 minutes", "60 minutes or 1 hour", "120 minutes or 2 hours"),
answer = "60 minutes or 1 hour"
)
# [1] 0 0 1 0
get_binary_score(
x = c(1:5, "Heart", "hello, world", NA),
answer = c(3, "heart")
)
# [1] 0 0 1 0 0 1 0 NA
# }
Run the code above in your browser using DataLab