Skip to contents

Checks whether the currently running RStudio version is >= a cached reference version. Intended to level up the RStudio version in use between multiple users of the same code (e.g. contributors to a specific R project).

Usage

lvl_up_rstudio(path_min_vrsn, update_min_vrsn = FALSE)

Arguments

path_min_vrsn

Path to the cached RStudio version string.

update_min_vrsn

Whether or not to overwrite path_min_vrsn with the currently running RStudio version string iff the latter is higher than the former.

Value

Currently running RStudio version as a numeric version, or NULL if RStudio is not running, invisibly.

Details

If the file path_min_vrsn exists, it is checked whether RStudio is running, and if so, whether its version number is greater than or equal to the version number stored in that file. If this is not the case, an alert is displayed.

If update_min_vrsn is set to TRUE and the file path_min_vrsn doesn't exist or contains an RStudio version string that's lower than the currently running version of RStudio, path_min_vrsn is overwritten with the currently running RStudio version string.

Note that since RStudio must be running for lvl_up_rstudio() to have any effect, it can't be directly called in a (project-level) .Rprofile startup script. Instead, the rstudio.sessionInit hook can be used. Example:

setHook(hookName = "rstudio.sessionInit",
        value = function(newSession) {
            if (newSession)
                salim::lvl_up_rstudio(path_min_vrsn = ".RStudio_version",
                                      update_min_vrsn = TRUE)
        },
        action = "append")

See also

Other development environment currentness functions: lvl_up_quarto(), lvl_up_r(), update_rpkgs(), update_salims_pkgs(), update_zdaarau_pkgs()