Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know the first R version to have a given function [duplicate]

Tags:

r

Is there a way to find out what version of R certain functions were introduced in? For example regmatches is a useful function but it is fairly new and I believe it was introduced with 2.14. How could I easily figure out something like regmatches was introduced in R 2.14?

like image 334
Dason Avatar asked Apr 11 '12 18:04

Dason


People also ask

What is duplicated function in R?

The R function duplicated() returns a logical vector where TRUE specifies which elements of a vector or data frame are duplicates.

How do I extract duplicate elements in R?

duplicated() function will return duplicated rows including the first of identical rows. logical: if TRUE , the function will return all variables in x after extracting duplicated or unique rows based on the variables specified in the argument ... .

Which function in R removes duplicate elements?

unique() function in R Language is used to remove duplicated elements/rows from a vector, data frame or array.

How to find the version of R in R?

Most of the times, we need to use packages in R and some packages are restricted to different versions in R, generally to newer versions. Therefore, we might need to find which version of R we are using. To find the R version, we can directly use the command R.Version ().

How do I check if R is installed or not?

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.

How to get the version of a loaded R package?

As far as I can tell, the only way to get the version of a loaded package is the rather hackish: where pkg is the package name. EDIT: I am not sure when this function was added, but you can also use getNamespaceVersion, this is cleaner: Show activity on this post. Or after you are in the R shell print the contents of version$version.string

What is R programming language used for?

R programming is a free and Open-source package used for data analysis. I will show you two ways to find which version of R is installed in your system


2 Answers

Even easier than Dirk's solution is to use R's news function:

> newsDB <- news()
> news(grepl("regmatches",Text), db=newsDB)
Changes in version 2.14.0:

NEW FEATURES

    o   New function regmatches() for extracting or replacing matched or
         non-matched substrings from match data obtained by regexpr(),
         gregexpr() and regexec().

As of R-3.3.0, news will launch via the HTML help system if it is available. You can suppress it via the print.news_db method:

> print(news(grepl("news",Text), db=newsDB), doBrowse=FALSE)
Changes in version 3.3.0:

NEW FEATURES

    o   news() now displays R and package news files within the HTML help
         system if it is available.  If no news file is found, a visible
         NULL is returned to the console.
like image 120
Joshua Ulrich Avatar answered Nov 16 '22 22:11

Joshua Ulrich


You can use the SVN repository:

edd@max:~/svn/r-devel/src/library/base/man$ svn log regmatches.Rd 
------------------------------------------------------------------------
r57006 | hornik | 2011-09-14 14:04:21 -0500 (Wed, 14 Sep 2011) | 1 line

Improve example.
------------------------------------------------------------------------
r56997 | hornik | 2011-09-12 15:16:03 -0500 (Mon, 12 Sep 2011) | 1 line

Document regmatches replacement function.
------------------------------------------------------------------------
r56893 | hornik | 2011-09-02 05:31:01 -0500 (Fri, 02 Sep 2011) | 1 line

Add first version of regmatches replacement function.
------------------------------------------------------------------------
r56818 | hornik | 2011-08-29 02:49:17 -0500 (Mon, 29 Aug 2011) | 1 line

Spelling.
------------------------------------------------------------------------
r56752 | hornik | 2011-08-18 01:40:07 -0500 (Thu, 18 Aug 2011) | 1 line

Add regmatches().
------------------------------------------------------------------------
edd@max:~/svn/r-devel/src/library/base/man$ 

I applied svn log to the manual page as I didn't immediately see the R file the function is defined in; the command would work the same way there...

like image 30
Dirk Eddelbuettel Avatar answered Nov 17 '22 00:11

Dirk Eddelbuettel