subsetting a matrix/array in R

January 7, 2010

(This article was first published on simon jackman's blog » R, and kindly contributed to R-bloggers)

From the R-devel svn log. Nice addition…

r50896 | falcon | 2010-01-05 12:05:31 -0800 (Tue, 05 Jan 2010) | 7 lines
Changed paths:
M /trunk/NEWS
M /trunk/src/include/Defn.h
M /trunk/src/library/base/man/Extract.Rd
M /trunk/src/main/subassign.c
M /trunk/src/main/subscript.c
M /trunk/src/main/subset.c
M /trunk/tests/Makefile.common
A /trunk/tests/array-subset.R

Allow n-dim arrays to be subsetted by an n-column character matrix

The character matrix is converted to the corresponding integer matrix
by matching against the dimnames of the array. NA values in any row
of the character matrix are propagated to the result. Unmatched
values result in a subscript out of bounds error. Empty string “” is
not allowed to match and therefore always results in an error.

I wonder about an option controlling the behavior of non-matches?

To leave a comment for the author, please follow the link and comment on their blog: simon jackman's blog » R. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...


Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)