[R] Delete an object which is named indirectly.
ressw m@iii@g oii meer@@et
ressw m@iii@g oii meer@@et
Fri Jul 25 22:26:23 CEST 2025
Make two objects
junk.A = -9999
junk.B = "junk.A"
rm(junk.B) removes junk.B and not junk.A, as it should.
Is there a function, e,g, "rm2", such that
rm2(junk.B) will delete junk.A and not junk.B?
Why doesn't this work?:
> rm(eval(junk.B))
Error in rm(eval(junk.B)) : ... must contain names or character strings
since eval(junk.B) yields "junk.A"
and
> rm("junk.A")
does work?
R version 4.3.0 (2023-04-21)
More information about the R-help
mailing list