http://stackoverflow.com/questions/3971844/access-variable-value-where-the-name-of-variable-is-stored-in-a-string-in-r
The key is the get() command in R. You just build a string str of the variable name, then use get(str) and the variable's value is output. e.g;
foo3 = 5
j = 3
get(gsub(" ","",paste('foo',j)))