Why is it a bad habit to parse and evaluate a string code (in R)? [duplicate]
问题 This question already has answers here : What specifically are the dangers of eval(parse(…))? (4 answers) Closed 6 years ago . I've been told that it is a bad habit to parse and evaluate a character string to_run = "for (i in 1:10){print(i);print('Hello World!')}" eval(parse(text=to_run)) Why is it a bad habit? It seems to me to be quite a flexible way of programming as we can construct our code in a iterative manner by pasting character strings together. For example it allows to easily deal