Learn R Programming

installr (version 0.8)

updateR: Checks for the latest R version, and if there is a newer version of R - downloads and installs it.

Description

This function performs the following steps:
  • Check what is the latest R version. If the current installed R version is up-to-date, the function ends (and returns FALSE)
  • If a newer version of R is available, the user is asked if to review the NEWS of the latest R version - in order to decide if to install the newest R or not.
  • If the user wishes to - the function will download and install it. (you will need to press the "next" buttons on your own)
  • Once the installation is done, you should press "any-key", and the function will proceed with copying all of your packages from your old (well, current) R installation, into your newer R installation.
  • You can then erase all of the packages in your old R installation.
  • After your packages are moved (and the old ones possibly erased), you will get the option to update all of your packages in the new version of R.
  • You will be asked if to open the Rgui of your new R.
  • Lastely - you can close the current session of your old R.

Usage

updateR(browse_news, install_R, copy_packages,
    keep_old_packages, update_packages, start_new_R,
    quit_R, print_R_versions = T, ...)

Arguments

browse_news
if TRUE (and if there is a newer version of R) - it opens the browser to the NEWS of the latest version of R, for the user to read through
install_R
TRUE/FALSE - if to install a new version of R (if one is available). If missing (this is the default) - the user be asked if to download R or not.Of course the installation part itself (the running of the .exe file) is dependent on the user.
copy_packages
TRUE/FALSE - if to copy your packages from the old version of R to the new version of R. If missing (this is the default) - the user will be asked for his preference (he should say yes, unless he is using a global library folder).
update_packages
TRUE/FALSE - if to update your packages in the new version of R (all packages will be updated without asking confirmation per package) If missing (this is the default) - the user will be asked for his preference (he should say yes, unless he i
keep_old_packages
- if the keep the packages in the library of the old R installation. If missing (this is the default) - the user will be asked for his preference (he should say yes, unless he is using a global library folder).
start_new_R
TRUE/FALSE - if to start the new R (Rgui) after we will quit the old R. Default is TRUE. It will try to start the 64 bit R version, if it does not exist, the 32 bit will be started. This may be less useful for people using RStudio or the likes
quit_R
TRUE/FALSE - if to quite R after the installation and package copying or not. If missing (this is the default) - the user is asked what to do.
print_R_versions
if to tell the user what version he has and what is the latest version (default is TRUE)
...
Other arguments (this is currently not used in any way)

Value

  • a TRUE/FALSE value on whether or not R was updated.

See Also

check.for.updates.R, install.R, copy.packages.between.libraries,

Examples

Run this code
updateR(T, T, T, T, T, T, T) # the safest upgrade option: See the NEWS, install R, copy packages, keep old packages, update packages in the new installation, start the Rgui of the new R, and quite current session of R
updateR() # will ask you what you want at every decision.

Run the code above in your browser using DataLab