0
我已经在一个文件下面的脚本(称之为“temp.R”):差运行RSCRIPT VS猿与库源
library(ape)
tree <- rbdtree(0.5, 0.05, 5)
bd.time(tree, 0, 0)
当我运行Rscript temp.R
我得到的一些结果:
$par
birth death
0.5289875 0.0000000
$SS
[1] 9.21573
$convergence
[1] 0
$iterations
[1] 6
$evaluations
function gradient
8 16
$message
[1] "relative convergence (4)"
然而,当我运行R和然后执行:
source('temp.R')
我得到以下错误:
Error in integrate(Pi, 0, Tmax) : non-finite function value
有没有人有任何想法为什么Rscript
和source
之间的差异,使一个工作,另一个失败?如果有帮助,这里是由R中运行version
输出:
_
platform x86_64-apple-darwin10.8.0
arch x86_64
os darwin10.8.0
system x86_64, darwin10.8.0
status
major 3
minor 0.1
year 2013
month 05
day 16
svn rev 62743
language R
version.string R version 3.0.1 (2013-05-16)
nickname Good Sport
UPDATE:当我运行Rscript temp.R
几次我有时会收到类似的错误信息运行source
时为:
Error in integrate(Pi, 0, Tmax) : non-finite function value
Calls: bd.time ... objective -> CDF.birth.death -> .CDF.birth.death2 -> integrate
Execution halted
使用种子123,它与Rscript一起使用,但它不使用source()。 – redcurry