问题
Suppose, I have function:
my_function<-function(string) return(string)
When I run it from R:
>my_function('string"with"quotes')
[1] "string\"with\"quotes"
It works well. But when I try to run this function from Shell:
R -e "source('./my_function.R'); my_function('string"with"quotes')"
It fails with error, because shell can't deal with quotes.
Is there any solution for this problem?
P.S. I need to run this function directly from Shell.
来源:https://stackoverflow.com/questions/22225253/run-from-shell-r-function-with-parameter-that-contains-quotes