0

I am new to R. My work laptop has all sorts of problems. I can't seem to install R via RStudio so I decided to try to install the packages manually using the folders just as I do in Python. Here are the steps I followed:

I ran.libPaths() in RStudio to determine where the packages are installed. It returned the following:

[1] "\\\\lbsjsh-mp-ns1/user$/H/R/win-library/3.5"                                                                 
[2] "C:/ProgramData/App-V/9053-3BB61A6E2F38/Root/R/R-3.5.0/library"

I noticed that packages are in the 1st path. I then navigated to the following site:

https://cran.r-project.org/web/packages/ggplot2/index.html

I downloaded: r-devel: ggplot2_3.3.6.zip

I then extracted the folder into the following directory: "\\lbsjsh-mp-ns1/user$/H/R/win-library/3.5"

When I run library(ggplot2)in RStudio I get the following error:

Error: package or namespace load failed for ‘ggplot2’ in rbind(info, getNamespaceInfo(env, "S3methods")):
 number of columns of matrices must match (see arg 2)
In addition: Warning message:
package ‘ggplot2’ was built under R version 4.3.0 

I even tried to install it using the zip file by typing the following in RStudio:

install.packages("C:\Users\H\Downloads\ggplot2_3.3.6.zip", repos = NULL, type="binary")

But I get the following error:

Error: '\U' used without hex digits in character string starting ""C:\U"

Does anyone know why this could be?. Any help would be greatly appreciated.

  • Does this answer your question? [Error in install.packages : type =="both" cannot be used with 'repos =NULL'](https://stackoverflow.com/questions/30123786/error-in-install-packages-type-both-cannot-be-used-with-repos-null) – SamR Jul 04 '22 at 13:46
  • 1
    The error message suggests an error with the path - "\" needs to be replaced with either "\\" or "/" when you specify a windows path as a string. – Miff Jul 04 '22 at 14:22
  • 1
    ...Probably explained better in [R FAQ 7.8](https://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-file-names-work-in-Windows_003f) – Miff Jul 04 '22 at 14:27
  • I used double backslashes and it gave me a new error message: Installing package into ‘\\lbsjsh-mp-ns1/user$/H/R/win-library/3.5’ (as ‘lib’ is unspecified) –  Jul 04 '22 at 19:09

1 Answers1

0
  1. Download the .zip file for the package from https://cran.r-project.org/
  2. Open RGui
  3. Packages -> Install package(s) from local file(s)
  4. Navigate to the desired .zip file and click OK
  5. Wait a short while whilst the package installs