I am facing an apparently easy problem in R. That is to make a function (say "foo") to quote (i.e., make a string) from a line of "code". This is the example:
foo( SELECT * FROM DATA LIMIT 100 )
The result must be:
"SELECT * FROM DATA LIMIT 100"
which is quoted (it is a string), without evaluation. That must work for any thing, like:
foo( 1234 ERE 34e3 & )
has to give:
"1234 ERE 34e3 &"
foo( x = 33 + 34 )
has to give:
"x = 33 + 34"
I am sure i miss something, but i really can not find a solution to this simple problem.
NEW EDIT :
We had many comments about the question and possible answers, very useful (see below), but none got the proper answer.
To clarify, i am ONLY interested on a general solution to the question I make.
So I look to know if there is a function that can do what i say above, i.e. :
quote ANY code/text,
INDEPENDENTLY of the specific context for what the function will be used.
Seems the answer is not easy or that is impossible. We can still try to see if we get a clever idea. Thank you !