Check which R version is running
You can check the current version of R running on your system with the different functions or variables that R provide. In this tutorial we will review them and its differences.
R.version
R.version
and version
are variables provided by R that returns a simple list with information about the version of R running. This information includes the platform for which R was built, the architecture, the underlying OS, the C runtime version, the CPU and OS, the mayor and minor version of R, the date of the release, the subversion number, the language (R), the version of R and its nickname.
R.version
version # Equivalent
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
crt ucrt
system x86_64, mingw32
status
major 4
minor 3.1
year 2023
month 06
day 16
svn rev 84548
language R
version.string R version 4.3.1 (2023-06-16 ucrt)
nickname Beagle Scouts
You can access an individual element by its name or index:
R.version[7] # major 4
R.version$major # "4"
R.Version()
R also provides a function that returns a list with all the information about the R version.
R.Version()
$platform
[1] "x86_64-w64-mingw32"
$arch
[1] "x86_64"
$os
[1] "mingw32"
$crt
[1] "ucrt"
$system
[1] "x86_64, mingw32"
$status
[1] ""
$major
[1] "4"
$minor
[1] "3.1"
$year
[1] "2023"
$month
[1] "06"
$day
[1] "16"
$`svn rev`
[1] "84548"
$language
[1] "R"
$version.string
[1] "R version 4.3.1 (2023-06-16 ucrt)"
$nickname
[1] "Beagle Scouts"
It is possible to access individual elements using the $
operator, as in the example below.
R.Version()$version.string
"R version 4.3.1 (2023-06-16 ucrt)"
R.version.string
R also provides other variable to get only the current R version running on your computer named R.version.string
.
R.version.string
"R version 4.3.1 (2023-06-16 ucrt)"
getRversion()
There is also other function named getRversion()
which returns only the mayor and minor version number of R, including the patchlevel.
getRversion()
‘4.3.1’
R_compiled_by()
Finally, there is other function related to the previous which returns the detail about the C and Fortran compilers used to build R.
R_compiled_by()
C Fortran
"gcc.exe (GCC) 12.2.0" "GNU Fortran (GCC) 12.2.0"