Learn R Programming

sfsmisc (version 1.1-19)

shortRversion: Short R Version String

Description

From base R's R.version.string, produce a somewhat shorter version, with or without date, notably also for patched or development versions of R.

Main use is for plotting or construction of file of variable names.

Usage

shortRversion(Rv = R.version, Rst = Rv$status,
              Rvstring = if (!is.null(s <- Rv$version.string)) s else R.version.string,
              date = Rst != "", spaces = TRUE)

Value

a character string, typically a shortened version of Rvstring.

Arguments

Rv

a list with some of the same components as R.version.

Rst

a string specifying the status of R's version. For released versions of R, this is ""; almost always use the default Rv$status.

Rvstring

a string with a default that should work even for R versions previous to 1.0.0.

date

logical specifying if the date of the R version should be included in the result; by default, this will be true only for non-released versions of R.

spaces

logical indicating if the result may contain spaces (aka ‘blanks’); setting it to false, replaces the blanks by "-" and "_".

Author

Martin Maechler

See Also

Examples

Run this code
shortRversion() ## (including the date, typically for an R Core developer)
## but this is shorter:
(Rver <- shortRversion(date=FALSE))
shortRversion(spaces=FALSE)# e.g. for a file of even directory name
shortRversion(spaces=FALSE, date=FALSE)# even shorter, ditto

## If you want even shorter { abbreviate() will remove spaces, too }:
abbreviate(shortRversion(), 11)
abbreviate(shortRversion(date=FALSE), 13)

Run the code above in your browser using DataLab