I have a named character vector:
dat <- c("1" = 0, "2" = 0, "3" = 1)
I know that to select a single element