Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R绘图功能代码作为标题_R_String_Function_Plot - Fatal编程技术网

R绘图功能代码作为标题

R绘图功能代码作为标题,r,string,function,plot,R,String,Function,Plot,如何将函数转换为字符串 更清楚地说:我有一个函数,它得到一个分位数函数,然后准备一些数据来绘图。我想在图的标题中包括分位数函数 myfunction = function(qfunc = function(p) qnorm(p)) { # do something plot(data, sub = qfunc) } 我希望绘图具有函数(p)qnorm(p)或任何已作为qfunc作为子选项传递的内容。 我该怎么做?deparse(substitute(qfunc)))应该做这个技巧。这解

如何将函数转换为字符串

更清楚地说:我有一个函数,它得到一个分位数函数,然后准备一些数据来绘图。我想在图的标题中包括分位数函数

myfunction = function(qfunc = function(p) qnorm(p)) {
  # do something
  plot(data, sub = qfunc)
}
我希望绘图具有
函数(p)qnorm(p)
或任何已作为qfunc作为子选项传递的内容。
我该怎么做?

deparse(substitute(qfunc)))
应该做这个技巧。这解决了我的问题
deparse
会做这个把戏:-)谢谢。
deparse(替换(qfunc))
会做这个把戏。这个解决了我的问题
deparse
成功:-)谢谢。