Check which R version is running

R introduction R basics
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 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.


version # Equivalent
platform       x86_64-w64-mingw32               
arch           x86_64                           
os             mingw32                          
crt            ucrt                             
system         x86_64, mingw32                  
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 also provides a function that returns a list with all the information about the R version.

[1] "x86_64-w64-mingw32"

[1] "x86_64"

[1] "mingw32"

[1] "ucrt"

[1] "x86_64, mingw32"

[1] ""

[1] "4"

[1] "3.1"

[1] "2023"

[1] "06"

[1] "16"

$`svn rev`
[1] "84548"

[1] "R"

[1] "R version 4.3.1 (2023-06-16 ucrt)"

[1] "Beagle Scouts"

It is possible to access individual elements using the $ operator, as in the example below.

"R version 4.3.1 (2023-06-16 ucrt)"


R also provides other variable to get only the current R version running on your computer named R.version.string.

"R version 4.3.1 (2023-06-16 ucrt)"


There is also other function named getRversion() which returns only the mayor and minor version number of R, including the patchlevel.



Finally, there is other function related to the previous which returns the detail about the C and Fortran compilers used to build R.

                         C                    Fortran 
    "gcc.exe (GCC) 12.2.0" "GNU Fortran (GCC) 12.2.0"