On 24.05.2012 12:58, abhagwat wrote:
I figured out how to use quotes and parentheses when using Rscript -e (on a
bash shell):
Rscript -e write\(1,\"a.txt\"\)
--> Question 1: why do the parentheses need to be escaped in the shell?
(More a shell than an R question)
Because the shell shopudl not interpret quotes and parantheses but pass
all the string to R.
Then I figured out how to use quotes and parentheses when calling Rscript
through system:
system('Rscript -e write\\(1,\\\'a.txt\\\'\\)')
--> Question 2: why exactly is it necessary to use double and triple
escapes? I kinda understand it, but not completely.
double: \ is a special character in R that escapes the second \
triple: actually a double \ for the reason geiven above, and then \' for
protecting the ' to be evaluated (i.e. indicating the end of the former
' before the Rscript).
Uwe Ligges
Thanks for your insights!
Adi
--
View this message in context:
http://r.789695.n4.nabble.com/quotes-in-Rscript-e-through-system-tp4631186.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.