R.Version Function in R (Examples) | Which Version is Currently Running?

 

In this tutorial you’ll learn how to extract the current version in the R programming language.

Table of contents:

Let’s get started!

 

Example 1: Apply R.Version() Function

This Example explains how to create a data object containing the currently running R version using the R.Version function. For this, we simply need to store the output of R.Version() in a data object:

my_version <- R.Version()        # Execute R.Version function
my_version                       # Print output
# $platform
# [1] "x86_64-w64-mingw32"
# 
# $arch
# [1] "x86_64"
# 
# $os
# [1] "mingw32"
# 
# $system
# [1] "x86_64, mingw32"
# 
# $status
# [1] ""
# 
# $major
# [1] "3"
# 
# $minor
# [1] "5.3"
# 
# $year
# [1] "2019"
# 
# $month
# [1] "03"
# 
# $day
# [1] "11"
# 
# $`svn rev`
# [1] "76217"
# 
# $language
# [1] "R"
# 
# $version.string
# [1] "R version 3.5.3 (2019-03-11)"
# 
# $nickname
# [1] "Great Truth"

As you can see, we have created a data object called my_version. This data object is a list containing different information about the currently running version of the R programming language.

For instance, it contains the list element version.string which is consisting of a character string showing the current version:

my_version$version.string        # Extract certain parameters
# "R version 3.5.3 (2019-03-11)"

 

Example 2: Print R Version as Character String to RStudio Console

In this Example, I’ll illustrate how to extract the currently running R version even quicker. The R programming language provides a predefined variable called R.version.string, which contains only the current version as character string:

R.version.string                 # Simplified copy of R.version$version.string
# "R version 3.5.3 (2019-03-11)"

As you can see, the content of this variable is exactly the same as the output of the previously created list element version.string (see Example 1).

 

Example 3: Print R.version Variable to RStudio Console

Another quick way to get information about the currently running R version is provided by the variable R.version. We simply can show the content stored in R.version as follows:

R.version                        # Return currently used R version to console
#                _                           
# platform       x86_64-w64-mingw32          
# arch           x86_64                      
# os             mingw32                     
# system         x86_64, mingw32             
# status                                     
# major          3                           
# minor          5.3                         
# year           2019                        
# month          03                          
# day            11                          
# svn rev        76217                       
# language       R                           
# version.string R version 3.5.3 (2019-03-11)
# nickname       Great Truth

 

Video, Further Resources & Summary

If you need more explanations on the R code of this article, I can recommend to have a look at the following video of my YouTube channel. I show the examples of this tutorial in the video.

 

Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube Content Consent Button Thumbnail

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.

 

Furthermore, you might read the other articles of this website. I have released numerous articles already.

 

In this article, I explained how to apply the R.Version function in R to check which version is currently running on a computer. Don’t hesitate to let me know in the comments, if you have any additional questions.

 

Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.


Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu
Top