updateR: Checks for the latest R version, and if there is a newer...

View source: R/updateR.R

updateRR Documentation

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.

  • Lastly - you can close the current session of your old R.

Usage

updateR(
  fast = FALSE,
  browse_news,
  install_R,
  copy_packages,
  copy_site_files,
  keep_old_packages,
  update_packages,
  start_new_R,
  quit_R,
  print_R_versions = TRUE,
  GUI = TRUE,
  to_checkMD5sums = FALSE,
  keep_install_file = FALSE,
  download_dir = tempdir(),
  silent = FALSE,
  setInternet2 = TRUE,
  cran_mirror = "https://cran.rstudio.com/",
  ...
)

Arguments

fast

logical (default is FALSE). If TRUE, it overrides other parameters and uses a set of defaults to make the R installation as fast as possible: no news, installr R, copy packages and Rprofile, keep old packages, updated packages, without quitting current R or starting the new R. don't use GUI, check MD5sums, keep installed file in the getwd.

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 their preference (he should say yes, unless they are using a global library folder).

copy_site_files

logical - if to copy your Rprofile.site and Renviron.site from the old version of R to the new version of R. If missing (this is the default) - the user will be asked for their preference (they should say yes, unless they are using a global library folder).

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 their preference (they should say yes, unless they are 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 their preference (they should say yes, unless they are using a global library folder). This is done by calling the Rscript in the new R.

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 quit 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 they have and what is the latest version (default is TRUE)

GUI

a logical indicating whether a graphics menu should be used if available. If TRUE, and on Windows, it will use winDialog, otherwise it will use menu.

to_checkMD5sums

Should we check that the new R installation has the files we expect it to (by checking the MD5 sums)? default is TRUE. It assumes that the R which was installed is the latest R version. parameter is passed to install.R()

keep_install_file

If TRUE - the installer file will not be erased after it is downloaded and run.

download_dir

A character of the directory into which to download the file. (default is tempdir())

silent

If TRUE - enables silent installation mode.

setInternet2

logical. Should setInternet2(TRUE) be run. (only relevant for versions of R before 3.3.0)

cran_mirror

URL of your preferred CRAN mirror. (default is https://cran.rstudio.com/)

...

Other arguments (this is currently not used in any way)

Details

It is worth noting that the function assumes that you are installing R in the same directory as before. That is, if the old R was on: D:RR-3.0.0 then the new R will be on D:RR-3.0.1.

Value

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

See Also

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

Examples

## Not run: 

updateR(TRUE) # This sets "fast" to be TRUE
# # the fastest/safest upgrade option: 
# install R while keeping a copy in the working directory,
# copy packages, keep old packages, 
# update packages in the new installation.

updateR() # will ask you what you want at every decision.

## End(Not run)

installr documentation built on Nov. 13, 2022, 1:06 a.m.