Suppose I have a character string of a subsetted object name. For example:
foo$var1[foo$var2 < 10 & foo$var3 %in% c(0:100)] #is currently represented as...
"foo$var1[foo$var2 < 10 & foo$var3 %in% c(0:100)]"
I want to call the subsetted object using the character string of the object's name.
I tried using get()
:
get("foo$var1[foo$var2 < 10 & foo$var3 %in% c(0:100)]")
but I get the error:
Error in "foo$var1[foo$var2 < 10 & foo$var3 %in% c(0:100)]":
object "foo$var1[foo$var2 < 10 & foo$var3 %in% c(0:100)]" not found
I'm assuming there is a way to do this using subsetted objects (vs. just an object name, which I know works).
Thanks in advance!