0

I just got a new computer with Windows 10 and now can't install packages. I have been looking up on Google/Stack overflow and I am getting the understanding that it is something wrong with the default library. I have tried going into the Control panel and writing a new environment path while also making a new folder for the packages to go into (C:/Program Files/R/Library). I have also gone into the Rprofile site files in both the "etc" and "base" folders and manually changed the default file. One of those has allowed me to at least not get the STRING_ELT() error immediately when I turn it on and have 2 paths for the default library, but I still get an list.files(lib). Please, if someone could help me.

Here are the links I have used and tried all the solutions: How do I change the default library path for R packages https://medium.com/@ValidScience/how-to-fix-rstudios-package-installation-on-windows-10-c1e602bf3a1f

Here is the code in R I have now:

.libPaths()
[1] "C:/Program Files/R/Library"         "C:/Program Files/R/R-3.2.2/library"

Error in list.files(.rs.uniqueLibraryPaths(), full.names = TRUE) : 
  STRING_ELT() can only be applied to a 'character vector', not a 'NULL'

Error in list.files(lib) : 
  STRING_ELT() can only be applied to a 'character vector', not a 'NULL'

install.packages("readxl")

Error in install.packages : STRING_ELT() can only be applied to a 'character vector', not a 'NULL'
Phil
  • 7,287
  • 3
  • 36
  • 66
  • 2
    Are you really using R 3.2.2? That was released over 6 years ago so if so try installing the latest version of R (4.1.2) and see if the error persists. – Ritchie Sacramento Feb 26 '22 at 03:08
  • Ah, I see! You are right! For some reason, it was using that old version of R. It now works with the R 4.1.2. Thank you! – rakoskia Feb 26 '22 at 22:00

1 Answers1

0

This is probably a Rstudio issue which loads its own DLLs and breaks stuff in R.

Just use R from command line, or install an older version of Rstudio (e.g. 1.1.453).

Davor Josipovic
  • 5,296
  • 1
  • 39
  • 57