Reputation: 855
Suppose I have set of variables test1, test2, test3, ..., testn. I wanted to remove them in a for loop using "eval" but it does not work. What is the solution? Thank you in advance.
for (i in 1:5)
rm(eval(parse(text=(paste0("test",i)))))
Error in rm(eval(parse(text = (paste0("test", i))))) :
... must contain names or character strings
Error during wrapup: cannot open the connection
Upvotes: 2
Views: 241