I can't install any packages in R using both R Console and RStudio. I'm trying to install tm package, and received the warning messages.
Installing package into ‘/R/win-library/4.1’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file 'C:/PROGRA~1/R/R-41~1.1/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://cloud.r-project.org/src/contrib:
cannot open URL 'https://cloud.r-project.org/src/contrib/PACKAGES'
Warning: unable to access index for repository https://cloud.r-project.org/bin/windows/contrib/4.1:
cannot open URL 'https://cloud.r-project.org/bin/windows/contrib/4.1/PACKAGES'
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
InternetOpenUrl failed: ''
2: package ‘tm’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
I've unchecked the "User secure download method for HTTP" in RStudio (as suggested in this link), but it's still the same. RStudio is allowed in my laptop's firewall settings by default, but I just added R for Windows terminal front-end in the allowed apps. Still I get the same error.
Session info
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
stepping away from Rstudio and R in the terminal for a moment, lets verify the following ...
if you paste the url into your browser does it succeed in downloading the csv?
[https://cran.r-project.org/CRAN_mirrors.csv]
I tried doing that in two ways. (1) Just by reading the CSV file using read.csv function , and (2) using download.file function to download the file into my default working directory (Documents).
Using the first method, I got the following:
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") : InternetOpenUrl failed: ''
While using second method, I got:
Error in download.file("https://cran.r-project.org/CRAN_mirrors.csv", :
cannot open destfile '~/Documents', reason 'Permission denied'
Is there some sort of a restriction that has been set in my laptop? Looks like it. Thanks.
I'm thinking its a general internet access issue you have. Therefore I really think it would be worthwhile of you to also attempt to do it in your web browser as I suggested...
Is this a personal laptop, or something set up by an organisation ?
I did it through the browser, but I was able to download the CRAN_mirrors.csv. It's a work laptop, but I've been using RStudio since last year without these errors until last night. Tried uninstalling both R and RStudio to no luck. So far, I haven't heard of any restrictions updates, but we shouldn't be getting such. Internet's pretty okay as there are no restricted sites.
ok, if you can get it through your browser there would seem to be hope. lets go back to download.file
The error read to me like you may have mispecified destfile ? do you get the same error when you try