For this case I would like select variables with any instance of Math and Eng and the numeric variables.
library(tidyverse)
dat1 <- tibble(
var1 = c("Math", "Kisw", "Computer", "Biology"),
var2 = c("Science", "Geog", "Studies", "Math"),
var3 = c("Kisw", "Math", "Phys", "Psychology"),
var4 = rnorm(4, 80, 5),
var5 = c("Yes", "No", "Yes", "No"),
var6 = c("No", "Yes", "No", "No"),
var7 = rnorm(4, 80, 5),
var8 = rnorm(4, 80, 5),
)
# dat1 %>%
# select(where(~ any(.x %in% c("Math", "Eng")), ~where(is.numeric)))