I would like to incorporate variable names that imply what I should do with them. I imagine a dataframe \"survey\".
library(Rlab) # Needed for rbern() functi
The "operators" package allows some Perl-like syntax:
library(operators) survey[, colnames(survey) %~% "bern"]
or
subset(survey, select = colnames(survey) %~% "bern")