What version of R is running on my computer?

There are two R directories on my computer:
one is /home/R-2.15.2 , the other is /home/R-2.15.1 ,
when I enter R , I can run R, now I want to know which R works: 2.15.1 or 2.15.2?

+15
source share
6 answers

Run R --version there on the version in the first line.

Edit: if you ask this question, I bet that R doesn't work with any of these directories. Check the $ PATH env variable for information on finding binary files and in what order.

Edit 2: Use the type shell command to find where the binary for this command is stored, -a for all paths, -f for hashed (basically: last time).

+11
source

In addition to @Piotr Jaszkowski, R.Version() should also do the job

+16
source

The built-in version will show this.

 > version _ platform x86_64-apple-darwin9.8.0 ... version.string R version 2.15.2 (2012-10-26) 

version is a named list of 14 elements, in fact you just want to see:

 > version[['version.string']] _ [1] "R version 2.15.2 (2012-10-26)" 

and in fact, if you want only the version string :

 > strsplit(version[['version.string']], ' ')[[1]][3] [1] "2.15.2" 

Enter builtins() to see all the built-in functions.

POSTSCRIPT: It turns out that version and R.version (mentioned by nathaninmac ) are aliases for the same thing.

+9
source

Try sessionInfo()

Next to version R, it also returns versions of downloaded packages and more.

http://stat.ethz.ch/R-manual/R-patched/library/utils/html/sessionInfo.html

+1
source

You can enter "what R" to which the binary R is used

or type R and see something like below that should tell you which version.

"R version 2.15.1 (2012-06-22) -" Fried Marshmallows "Copyright (C) 2012 R Foundation for Statistical Computing .. .."

0
source

It will also help.

 paste0(R.Version()[c("major","minor")], collapse = ".") 
0
source

All Articles