You're probably looking for something similar to this:

glm(as.formula(paste0('casecontrol ', 'rs', I data = mydata, family = binomial)) lapply(1:30, function(i) glm(as.formula(paste0('casecontrol ', 'rs', I data = mydata, family = binomial))

This command will run 30 logistic regressions with the chosen predictor.

Rather of hard-coding the total number of predictors, use sum(grepl('rs', names(mydata)), which returns 30.

To get the summary in a tidy format, use the tidy function from the broom package.

data.frame(model = I tidy(glm(as.formula(paste0('casecontrol ', 'rs', I data = mydata, family = binomial))) purrr::map dfr(1:30, function(i) data.frame(model = I tidy(glm(as.formula(paste0('casecontrol ', 'rs', I