I'm trying to print out all the variables in my environment that are of a certain type (for example 'matrix). I tried
for(f in ls()) {if(is.matrix(f) print(f) }
Obviously, this doesn't work because ls() returns a list of strings. I tried other things, but I can't seem to convert the string f into the variable f. Does anyone know how to do that?
In a nutshell, if I have a string variable y that holds "x", and x is also a variable in my environment, I want to use y to access x. Of course, I may not know a priori what value y holds.