我想使用R包brms
,但是我得到了一个我无法解释的错误。它可能与Rtools
有关,然而brms
安装在我的电脑上。
这是 fit1 <- brm(count ~ log_Age_c + log_Base4_c * Trt_c
+ (1|patient) + (1|visit) + (1|obs),
data = epilepsy, family = poisson(),
prior = c(set_prior("student_t(5,0,10)", class = "b"),
set_prior("cauchy(0,2)", class = "sd")))
包中的一个例子:
system("g++ -v")
这是我得到的错误:
compileCode出错(f,代码,语言=语言,详细=详细): 编译错误,未创建的功能/方法! c:/ Rtools / mingw_64 / bin / g ++:找不到 make:*** [file202834c75e9.o]错误127 警告信息: l'exécutiondela commande'make -f“C:/PROGRA~1/R/R-33~1.0/etc/x64/Makeconf”-f“C:/PROGRA~1/R/R-33~1.0/ share / make / winshlib.mk“SHLIB_LDFLAGS ='$(SHLIB_CXXLDFLAGS)'SHLIB_LD ='$(SHLIB_CXXLD)'SHLIB =”file202834c75e9.dll“WIN = 64 TCLBIN = 64 OBJECTS =”file202834c75e9.o“'renvoie un statut 2 另外:警告信息: 运行命令'C:/PROGRA~1/R/R-33~1.0/bin/x64/R CMD SHLIB file202834c75e9.cpp 2> file202834c75e9.cpp.err.txt'的状态为1
谢谢你的帮助
实际上,这是Rtools的一个问题。 rstan
给你什么?如果它是状态127,则R找不到Rtools。很可能,在Rtools安装期间您没有选中该框,要求您修改系统路径。我建议您解开Rtools并重新安装它,确保选中此框。另请确认您使用的是与R版兼容的正确版本的Rtools。
我在安装In find_rtools() :
WARNING: Rtools 3.4 found on the path at c:/Rtools is not compatible with R 3.3.1.
Please download and install Rtools 3.3 from http://cran.r-project.org/bin/windows/Rtools/, remove the incompatible version from your PATH, then run find_rtools().
时遇到了类似的问题。 RTools33出现问题。安装RTools34似乎解决了这个问题,虽然我现在得到以下警告:
R-{version}\etc\x64\Makeconf
到目前为止,这个警告似乎是良性的
要修复此错误:“c:/ Rtools / mingw_64 / bin / g ++:not found”我找到了C:驱动器上的RBuildTools文件夹,在bin文件夹中找到了g ++文件,复制了mingw_64文件夹(或者你的g ++文件所在的位置)位于),在C:上创建了一个Rtools文件夹并粘贴了mingw_64文件夹。这将创建使用stan()函数编译R代码所需的C:/ Rtools / mingw_64 / bin /路径。
我在Windows配置上关注了rStan wiki Makevars
。
而不是在c:\中黑客攻击here,你可以按照%HOM%\.R\Makevars.win64
指令创建你的个人。
在我的qazxswpoi文件中
CXXFLAGS = -O3 -mtune = native -march = native -Wno-unused-variable -Wno-unused-function BINPREF =“H:/ RTools / mingw_64 / bin /”
这解决了我的问题。