something like this (using vals and arr from your example)?
vals
arr
the_letter <- 'B' picklist <- Map(vals, f = \(val) ifelse(val == the_letter, 1, TRUE)) do.call(`[`, c(list(x = arr), picklist))