首页 > 解决方案 > R:运行 stan() 函数得到一些错误:

问题描述

当我运行 stan() 函数时,我收到关于文件中的错误(con,“r”)的两个错误:无法打开连接和接收器中的错误(类型 =“输出”):无效连接。顺便说一句,我的 .stan 文件是正确的。请帮忙。

> rstan:::rstudio_stanc("8schools.stan")
8schools.stan is syntactically correct.
> schools_dat <- list(J = 8, 
+                     y = c(28,  8, -3,  7, -1,  1, 18, 12),
+                     sigma = c(15, 10, 16, 11,  9, 11, 10, 18))
> fit_8schools <- stan(file = 'C:/Users/.../Desktop/8schools.stan', data = schools_dat)
The NEXT version of Stan will not be able to pre-process your Stan program.
Please open an issue at
 https://github.com/stan-dev/stanc3/issues 
if you can share or at least describe your Stan program. This will help ensure that Stan
continues to work on your Stan programs in the future. Thank you!
This message can be avoided by wrapping your function call inside suppressMessages().
Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In file.remove(c(unprocessed, processed)) :
  cannot remove file 'C:\Users\lpb\AppData\Local\Temp\RtmpW6qdvg\file1f7436407ba4.stan', reason 'No such file or directory'
2: In system(cmd, intern = !verbose) :
  running command 'D:/ProgramFiles/R-4.0.2/bin/x64/R CMD SHLIB file1f741c6e1040.cpp 2> file1f741c6e1040.cpp.err.txt' had status 1
3: In file(con, "r") :
  cannot open file 'file1f741c6e1040.cpp.err.txt': No such file or directory
Error in sink(type = "output") : invalid connection

> setInternet2(TRUE) 
Error: 'setInternet2' is defunct.
See help("Defunct")

标签: rrstan

解决方案


推荐阅读