我首先在Windows 10上更新了R(从3.6.3到4.0(,然后更新了RStudio(从1.2.5033到最新的1.2.5042(。因为我一直收到下面的错误消息,所以我降级到R 3.6.3和Rstudio 1.1.463。然而,错误仍然存在。打开RStudio时,我收到以下信息:
Error: package or namespace load failed for ‘stats’ in inDL(x, as.logical(local), as.logical(now), ...):
unable to load shared object 'C:/Program Files/R/R-3.6.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure:....
During startup - Warning message:
package ‘stats’ in options("defaultPackages") was not found
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Program Files/R/R-3.6.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure:...
stats.dll位于上述位置。有趣的是,我可以在R.exe中使用stats包中的函数,这表明RStudio导致了错误。同样,我无法打印sessionInfo((:
Error in La_library() : LAPACK routines cannot be loaded
In addition: Warning message:
In La_library() :
unable to load shared object 'C:/PROGRA~1/R/R-36~1.3/modules/x64/lapack.dll':
LoadLibrary failure:...
即使lapack.dll在正确的位置。
看起来R的旧版本(3.6.3(和新版本(4.0(的文件夹之间存在混淆,另请参阅此答案。
建议:卸载R的两个版本,并将R 4.0从头安装到一个新文件夹中。