In addition, I have an object called "variables" which simply contains some of the column names from "trial" (but never the ID column) as a character vector. E.g. "variables" : Var3 Var27 Var91
I want to write some code to sum the values down each column in "trial" that are in my "variables" list. How can I go about doing this? The reason why I can't do it manually (i.e. sum(trial$var3), etc.) is because this "variables" object is sometimes recycled and replaced with a new "variables" list with different column names from "trial". I hope that makes sense.