2017-03-05 43 views
1

最近,我开始意识到Rprof()函数。我试着运行各种示例,但似乎没有一个能够工作。下面我给你是其中之一:执行Rprof()后空输出文件

脚本我R中运行:

# Turn on the profiler. By default it will write its output 
# to a file called Rprof.out in my R directory 
Rprof() 

# code to be profiled 
y <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) 
x <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) 
lm(y ~ x) 

# Turn off the profiler 
Rprof(NULL) 

# getting a summary of the output 
summaryRprof() 
$by.self 
[1] self.time self.pct total.time total.pct 
<0 rows> (or 0-length row.names) 

$by.total 
[1] total.time total.pct self.time self.pct 
<0 rows> (or 0-length row.names) 

$sample.interval 
[1] 0.02 

$sampling.time 
[1] 0 

而且,当我打开r中Rprof.out文件,它只有一条线是以下几点:

sample.interval = 20000

我将不胜感激什么,我做错了什么帮助,因为我本来期望的输出应该不会有0行,但应具有lm,mfitlm调用堆栈中的所有其他功能。

我使用Rx64 3.3.1(通过R studio),我的操作系统是Windows 10 64位。

回答

0

您的代码运行时间小于采样间隔(20毫秒),因此没有结果。

+1

谢谢约书亚。我确实尝试了一个更复杂的代码,这次总结返回了一个有意义的输出(不同于0行)。 –