Reputation: 457
Following this post and also this link , I tried to update my R version .
sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] installr_0.9
loaded via a namespace (and not attached):
[1] tools_2.14.0
But when I ran the code
updateR()
Error in file(con, "r") : cannot open the connection
It shows exactly the same error while running the following command :
check.for.updates.R() # tells you if there is a new version of R or not.
Error in file(con, "r") : cannot open the connection
install.R() # download and run the latest R installer
Error in file(con, "r") : cannot open the connection
How can I update my R version ?
Upvotes: 13
Views: 6385
Reputation: 461
Per https://github.com/talgalili/installr/#troubleshooting,
Try running:
setInternet2(TRUE)
That worked for me when I was getting the below error message:
Error in file(con, "r") : cannot open the connection
Upvotes: 36
Reputation: 56935
The URLs of the installr
package are probably out of date. Just go the R website and download the latest version.
You will have to reinstall your packages manually though, which can be a pain. You can use rownames(installed.packages())
in your old R to get a list of the packages you currently have installed so that when you go to your new R you can just work down the list and install them all again.
You could even do
sprintf('install.packages(%s)', paste(shQuote(rownames(installed.packages())),collapse=','))
and then copy-paste that command into your new R to try reinstall everything you had installed on your old R. I personally prefer though to just install them as I need them, so that if I had packages I no longer use in the old R, I don't bother to reinstall them on the new R unless I need them.
Also, the above may fail simply because your current R is quite old compared to the new R so some packages may no longer be compatible.
Upvotes: 3