Which version of R is running in my computer?

时光毁灭记忆、已成空白 提交于 2019-12-04 00:32:43

Run R --version there's info about version on the first line.

Edit: If you ask this question then I bet that R is not running from any of these directories. Check $PATH env variable to get information where binaries are looked for and in which order.

Edit 2: Use type shell command to find where binary for given command is stored, -a for all paths, -f for the hashed one (basically: most recently used).

In addition to @Piotr Jaszkowski, R.Version() should do the work as well

The builtin 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 with 14 items, really you just want to see:

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

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

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

Type builtins() to see all the builtins.

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

Try sessionInfo()

Next to the R version it also returns the versions of the loaded packages and more.

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

This will do the trick as well

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

You can type 'which R' to which R binary gets used

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

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!