I wanted to run some code that uses the 'rethinking' library. As instructed there, I first installed rstan, which went fine, then typed
install_github("rmcelreath/rethinking")
The latter gives the errors:
Error: package or namespace load failed for 'ggplot2' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace 'ellipsis' 0.3.1 is being loaded, but >= 0.3.2 is required
Error: package 'ggplot2' could not be loaded
In addition: Warning messages:
1: package 'rstan' was built under R version 4.0.5
2: package 'StanHeaders' was built under R version 4.0.5
3: package 'ggplot2' was built under R version 4.0.5
Execution halted
ERROR: lazy loading failed for package 'rethinking'
* removing 'C:/Program Files/R/R-4.0.3/library/rethinking'
Warning messages:
1: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Program Files\R\R-4.0.3\library\00LOCK\curl\libs\x64\curl.dll to C:\Program Files\R\R-4.0.3\library\curl\libs\x64\curl.dll: Permission denied
2: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Program Files\R\R-4.0.3\library\00LOCK\ps\libs\x64\ps.dll to C:\Program Files\R\R-4.0.3\library\ps\libs\x64\ps.dll: Permission denied
3: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Program Files\R\R-4.0.3\library\00LOCK\ellipsis\libs\x64\ellipsis.dll to C:\Program Files\R\R-4.0.3\library\ellipsis\libs\x64\ellipsis.dll: Permission denied
4: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Program Files\R\R-4.0.3\library\00LOCK\digest\libs\x64\digest.dll to C:\Program Files\R\R-4.0.3\library\digest\libs\x64\digest.dll: Permission denied
5: In i.p(...) :
installation of package ‘C:/Users/User/AppData/Local/Temp/RtmpAfQQaY/file1268133e3024/rethinking_2.13.tar.gz’ had non-zero exit status
> source("~/.active-rstudio-document", echo=TRUE)
Indeed, if I try to run code from the library, I get:
> library(rethinking)
Error in library(rethinking) : there is no package called ‘rethinking’
I am running Rstudio 2021.09.0 as administrator, on Windows 10.
I also tried installing the library from the Packages|Install button, but that gives
> install.packages("rethinking")
Warning in install.packages :
package ‘rethinking’ is not available for this version of R
The solutions suggested here did not work for me. Any help would be appreciated!
EDIT: for solution, please see comments - thanks for the replies!