rr-inla

system shows two paths concurrently in > .libPaths()-Windows OS, R 4.3.2


I am trying to fix the lib path because of the "as ‘lib’ is unspecified" warning that I get when I try to install the INLA package from the zip folder through R Tools, install packages as a result, I am unable to proceed with the installation.

The issue that I have is that the tutorials I am following (https://www.youtube.com/watch?v=sbp5Q8niTho) and (https://www.youtube.com/watch?app=desktop&v=F8bx4oyBRR4) by default have two paths. In my case, I have two paths that appear as one, I do not have 1 and 2 to allow me to reorder, but only 1. Also, my directory exists whereas his does not, mine is TRUE, and when I try to edit the environment to create a new path, the edit environment function does not allow me to.

How to address my issue to set the lib path correctly?

> .libPaths()
[1] "C:/Users/name/AppData/Local/R/win-library/4.3" "C:/Program Files/R/R- 
4.3.2/library

> Sys.getenv("R_LIBS_USER")
[1] "C:\\Users\\name\\AppData\\Local/R/win-library/4.3"

> dir.exists(Sys.getenv("R_LIBS_USER"))
[1] TRUE

> usethis::edit_r_environ()
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Users/name/AppData/Local/R/win- 
library/4.3/purrr/libs/x64/purrr.dll':
  LoadLibrary failure:  The specified procedure could not be found.

I am including the update I did as per the answer however I am still failing to set the path accordingly

First <- function(){
  .libPaths("C:/Program Files/R/R-4.3.2/library")
}

# set a site library
.Library.site <- "C:/Program Files/R/R-4.3.2/library"

# Things you might want to change

# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")

# set the default help type
# options(help_type="text")
  options(help_type="html")

# set a site library
# .Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")

# set a CRAN mirror
# local({r <- getOption("repos")
#       r["CRAN"] <- "http://my.local.cran"
#       options(repos=r)})

# Give a fortune cookie, but only to interactive sessions
# (This would need the fortunes package to be installed.)
#  if (interactive()) 
#    fortunes::fortune()

Below is the picture of what is returned from .libpaths: enter image description here

It looks completely different from the path in the video I am following of a different version. enter image description here

I actually can see now that in my case, I do not have site-library path and library, instead, I have wind-library and library, which returns as one path.


Solution

  • My problem appeared to have been path issues. With the INLA_23.05.30-1 zip file which is compatible with R 4.3.2 (https://www.r-inla.org/download-install), I was able to successfully install it by accessing the zip folder from the downloads and running the code below in the console:

    tmp_lib <- file.path(tempdir(), "testlib")
    dir.create(tmp_lib, showWarnings = FALSE)
    
    install.packages("C:/Users/your user name/Downloads/INLA_23.05.30-1.zip",
                     lib = tmp_lib,
                     repos = NULL,
                     type = "win.binary")
    
    library(INLA, lib.loc = tmp_lib)