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
,mfit
和lm
調用堆棧中的所有其他功能。
我使用Rx64 3.3.1(通過R studio),我的操作系統是Windows 10 64位。
謝謝約書亞。我確實嘗試了一個更復雜的代碼,這次總結返回了一個有意義的輸出(不同於0行)。 –