Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/71.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
把Rprof和R搞混了_R - Fatal编程技术网

把Rprof和R搞混了

把Rprof和R搞混了,r,R,我不知道如何让Rprof与R一起工作 我按照文档中的示例进行操作,得到了如下结果 Rprof(filename="testProfile.out") test() Rprof(NULL) summaryRprof("testProfile.out") 然而,在testProfile.out内部,我有一行:sample.interval=20000 这让我很困惑,当我运行summaryRProf时,我得到没有记录任何事件 如果您有任何建议,我们将不胜感激。问题是我的测试完成得太快,而且Rprof

我不知道如何让
Rprof
与R一起工作

我按照文档中的示例进行操作,得到了如下结果

Rprof(filename="testProfile.out")
test()
Rprof(NULL)
summaryRprof("testProfile.out")
然而,在
testProfile.out
内部,我有一行:
sample.interval=20000

这让我很困惑,当我运行
summaryRProf
时,我得到
没有记录任何事件


如果您有任何建议,我们将不胜感激。

问题是我的测试完成得太快,而且Rprof的日志记录速度不够快。要解决此问题,您可以设置
interval=0.0002
或一些小于默认值(
0.02
)的数字。我还可以通过多次迭代运行测试来解决这个问题。

test()做什么?配置文件的工作代码。因此,如果test()返回一个无法找到函数test()的错误,则不会记录任何事件。。假设test=function(){for(1:50中的i)print(i)}作为产生上述问题的示例,将
1:50
更改为
1:5000
,您将开始看到一些东西。实际上,您的
test()
对于默认的
interval=0.02
来说太快了。您也可以尝试为(1:100中的i)test()评测