将 R 更新到 4.0.3 并将 RStudio 更新到最新版本后,我遇到了这些问题中描述的 RStudio 和 RTools 的协整问题(在 R 为 3.6 和 RTools 35 之前,一切正常): https://community.rstudio。 com/t/problems-with-r-4-0-0-windows-error-package-or-namespace-load-failed-for-stats-in-indl-x-as-logical-local-as-logical-现在/62958/6
https://community.rstudio.com/t/rtools-not-found-after-r-4-0-0-installation/63356/3
我发现我应该为我的用户设置一些环境变量。但是,我不明白该怎么做,尽管 RTolls 的新路径应该有路径C:\rtools40\usr\bin
(旧 Rtools 版本是 C:\RTools\bin
. 你能帮忙吗?
另外,我做了这些步骤,但下载包时出错
> Sys.setenv(PATH = paste("C:/rtools40/usr/bin", Sys.getenv("PATH"), sep=";"))
> install_github("brettjbush/R-Websockets")
Downloading GitHub repo brettjbush/R-Websockets@HEAD
√ checking for file 'C:\Users\NAME\AppData\Local\Temp\RtmpSMB4KM\remotes2bcc582622c6\brettjbush-R-Websockets-fc7ee9c/DESCRIPTION' (598ms)
- preparing 'websockets':
√ checking DESCRIPTION meta-information ...
- cleaning src
Warning in system2(command, args, stdout = NULL, stderr = NULL, ...) :
'CreateProcess' failed to run 'C:\rtools40\usr\bin\make.exe -f "C:/PROGRA~1/R/R-40~1.3/share/make/clean.mk" -f Makevars.win clean'
然后我尝试了以下并得到了不同的错误
> Sys.setenv(PATH = paste("C:/rtools40/usr/bin", Sys.getenv("PATH"), sep=";"))
> Sys.setenv(BINPREF = "C:/rtools40/mingw_$(WIN)/bin/")
> install_github("brettjbush/R-Websockets")
Downloading GitHub repo brettjbush/R-Websockets@HEAD
brettjbush-R-Websockets-fc7ee9c/man/websocket_close.Rd: truncated gzip input
tar.exe: Error exit delayed from previous errors.
Error: Failed to install 'websockets' from GitHub:
Does not appear to be an R package (no DESCRIPTION)
In addition: Warning messages:
1: In utils::untar(tarfile, ...) :
‘tar.exe -xf "C:\Users\NAME\AppData\Local\Temp\RtmpSMB4KM\file2bccd21558.tar.gz" -C "C:/Users/NAME/AppData/Local/Temp/RtmpSMB4KM/remotes2bcc2b6a75d4"’ returned error code 1
2: In system(cmd, intern = TRUE) :
running command 'tar.exe -tf "C:\Users\NAME\AppData\Local\Temp\RtmpSMB4KM\file2bccd21558.tar.gz"' had status 1