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() function.
survey <- data.frame(cbind(
id = seq(1:10),
likert_this = sample(seq(1:7),10, replace=T),
likert_that = sample(seq(1:7), 10, replace=T),
dim_bern_varx = rbern(10, 0.6),
disc_1 = sample(letters[1:5],10,replace=T)))
Now I would like to do certain things with all variables that contain likert, other things with variables that contain bern etc.
How can this be done in R?