Related: Strings as variable references in R Possibly related: Concatenate expressions to subset a dataframe
I\'ve simplified the question per the comment
What works best for me is using quote() and eval() together.
quote()
eval()
For example, let's print each column using a for loop:
for loop
Columns <- names(dat) for (i in 1:ncol(dat)){ dat[, eval(quote(Columns[i]))] %>% print }