run from Shell R function with parameter, that contains quotes

99封情书 提交于 2019-12-11 08:16:41

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!