Check the Version of R

  1. Check R Version With the R.version Function
  2. Check R Version With the sessioninfo() Function

R language, like any other programming language, is updated regularly. New functions and features are added regularly, and some also get deprecated, which may lead to errors if one is not aware of these changes. Thus, it is essential to know what version of R is installed on your device.

One can check the directories to see which version of R is running on your device. Otherwise, we have a couple of built-in functions also available, which can tell the same.

Check R Version With the R.version Function

The first of which is the R.version function. We get a whole bunch of information when we run this command.

R.version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          4                           
minor          0.2                         
year           2020                        
month          06                          
day            22                          
svn rev        78730                       
language       R                           
version.string R version 4.0.2 (2020-06-22)
nickname       Taking Off Again

As you can see, version.string shows the current version of R. We can also directly extract this by running the following command:

R.version.string
[1] "R version 4.0.2 (2020-06-22)"

Check R Version With the sessioninfo() Function

Another way of checking which version of R is installed is using the sessioninfo() function, which provides the current version and other details of the system it is running on, the current packages, and more.

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_India.1252  LC_CTYPE=English_India.1252   
[3] LC_MONETARY=English_India.1252 LC_NUMERIC=C                  
[5] LC_TIME=English_India.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2    tinytex_0.26   xfun_0.17