0

When I try to install a package, I get the following message on RStudio

install.packages("lubridate")

R Session Aborted

image

EDIT : It does work in RGui though

--- Please select a CRAN mirror for use in this session ---   
trying URL 'https://cran.irsn.fr/bin/windows/contrib/4.1/lubridate_1.8.0.zip'  
Content type 'application/zip' length 1719785 bytes (1.6 MB) downloaded 1.6 MB    
package ‘lubridate’ successfully unpacked and MD5 sums checked  
The downloaded binary packages are in   
        C:\Users\user\AppData\Local\Temp\RtmpUF39l4\downloaded_packages

But when I load the package in RStudio, I get an error

library(lubridate)

Error in library(lubridate) : there is no package called ‘lubridate`
Julien
  • 1,613
  • 1
  • 10
  • 26
  • What happens if you open R itself (not within RStudio) and run that line? – Phil Aug 18 '22 at 16:12
  • It does work in RGui ! – Julien Aug 18 '22 at 16:16
  • That's interesting. I would just check that you have the latest version of RStudio, and that the installation is succesful by running `library(lubridate)`. If both are true, it might be worth filing an issue to RStudio about it. – Phil Aug 18 '22 at 16:18
  • But when I load the package in RStudio with `library(lubridate)`, I get `Error in library(lubridate) : there is no package called ‘lubridate` – Julien Aug 18 '22 at 16:19
  • Ok, so the installation was not successful. Can you copy and paste the the output of `install.packages("lubridate")`? – Phil Aug 18 '22 at 16:21
  • The ouput in RGui ? – Julien Aug 18 '22 at 16:23
  • `--- Please select a CRAN mirror for use in this session --- trying URL 'https://cran.irsn.fr/bin/windows/contrib/4.1/lubridate_1.8.0.zip' Content type 'application/zip' length 1719785 bytes (1.6 MB) downloaded 1.6 MB package ‘lubridate’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\user\AppData\Local\Temp\RtmpUF39l4\downloaded_packages` – Julien Aug 18 '22 at 16:23
  • 1
    I'm not sure why the package is not being seen by R after its installation. If you run `.libPaths()` and go that folder, do you have your other packages installed fine? – Phil Aug 18 '22 at 17:03
  • Run `.libPaths()` in both RGui and RStudio. I suspect they are different, and maybe RStudio is trying to use a library in a location it doesn't have permission for or something. Reinstalling RStudio might be a good step too. – Gregor Thomas Aug 18 '22 at 18:36
  • I had launched RGui but not with the same version of R as the one running in RStudio. I ran `install.packages("lubridate")` with the correct RGui (R 4.2.1) and now lubridate can be loaded in RStudio – Julien Aug 19 '22 at 07:47

0 Answers0