Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.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中找不到运行包fanplot示例的ew.txt文件_R - Fatal编程技术网

在R中找不到运行包fanplot示例的ew.txt文件

在R中找不到运行包fanplot示例的ew.txt文件,r,R,我试图按照包fanplot中的一个示例进行操作,但找不到ew.txt文件。 我将非常感谢你的帮助 data(ew) plot(ew) ## Not run: plot(ew.mcmc) ## ##Create your own (longer) MCMC sample ## # data r <- diff(log(ew)) r <- ts(exp(r) - 1, start(ew)) library("R2OpenBUGS") # write model file: ew.

我试图按照包fanplot中的一个示例进行操作,但找不到ew.txt文件。 我将非常感谢你的帮助

data(ew)
plot(ew)

## Not run: 
plot(ew.mcmc)

##
##Create your own (longer) MCMC sample
##
# data
r <- diff(log(ew))
r <- ts(exp(r) - 1, start(ew))

library("R2OpenBUGS")
# write model file:
ew.bug <- dget(system.file("model", "ew.txt", package = "fanplot"))
write.model(ew.bug, "ew.txt")
# take a look:
file.show("ew.txt")
# run openbugs
ew.mcmc <- bugs(data = list(N = length(r), H = 25, r = c(r), p = c(ew)),
                inits = list(list(a = exp(12), psi = 0.5, itau2 = 0.5)),
                param = c("alpha", "psi", "tau", "r.new", "p.new", "y.sim"),
                model = "ew.txt", 
                n.iter = 11000, n.burnin = 1000, n.chains = 1, n.thin = 1)

## End(Not run)
数据(ew)
绘图(ew)
##不运行:
地块(ew.mcmc)
##
##创建您自己的(更长的)MCMC示例
##
#资料

r在交互式会话中运行此代码时,请使用
getwd
查看您的工作目录。这应该是包含保存的文本文件的目录。

该文件位于
R\u LIBS/fanplot/model/
中,其中
R\u LIBS
是程序包库的位置

在示例代码中,可通过
system.file()
找到该文件:


然后,下一行将模型写入
ew.txt文件working目录中的。不清楚您想要哪个
ew.txt
。如果软件包附带的软件包在
R_LIBS
中找到它,如上所述。或者从CRAN下载源tarball(来自.

tar.gz
谢谢,我在R_LIBS/fanplot/目录中查找,没有子目录:model。我也在fanplot中的其他子目录中查找,但在任何地方都找不到ew.txt。您使用的是什么操作系统?我刚刚查找,版本1.0的
model
目录在包源代码中的错误位置,因此它无法运行。)er已安装(它应该是
PKG\u ROOT/inst/model
,但它是
PKG\u ROOT/model
).1.1版修复了此问题,但Windows和MacOS X尚未提供。我的答案与1.1版有关;该文件不存在于1.0版的安装包中。非常感谢您的帮助。我在Windows上。@adam-888我在发布tsbugs包时从fanplot包中删除了ew.txt BUGS文件。请参阅更新的exfanplot软件包的手册和/或vignette中有足够的代码来运行这些模型并绘制风扇。我为混乱道歉。这似乎是当时最合乎逻辑的事情。
system.file("model", "ew.txt", package = "fanplot")