Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get my R version

Tags:

version

r

To get the version of my R installation I use

R.Version()

and it produces a long output:

> R.Version()
$platform
[1] "x86_64-w64-mingw32"

$arch
[1] "x86_64"

# many more things

until I get the:

$version.string
[1] "R version 3.1.2 (2014-10-31)"

I also see the version as the first text from the R Console:

R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

# many other things

However, I wonder: is there any way to get the exact version without getting the rest of info? That is, is there any way to just get this:

R version 3.1.2 (2014-10-31)
like image 892
fedorqui 'SO stop harming' Avatar asked Jan 18 '15 10:01

fedorqui 'SO stop harming'


1 Answers

From within R:

R.version.string
## [1] "R version 3.1.0 (2014-04-10)"

From the command-line you can grep it out:

> R --version| grep -Eo 'R version [0-9.]+ \([0-9]{4}-[0-9]{2}-[0-9]{2}\)';
## R version 3.1.0 (2014-04-10)
like image 158
bgoldst Avatar answered Oct 12 '22 22:10

bgoldst