From henrik.bengtsson at ucsf.edu  Sat May  9 02:53:15 2015
From: henrik.bengtsson at ucsf.edu (Henrik Bengtsson)
Date: Fri, 8 May 2015 17:53:15 -0700
Subject: [Rd] R Language Definition: Subsetting matrices with negative
 indices is *not* an error
Message-ID: <CAFDcVCQdx0XQaBgw8rNrN0ayB8fxbiFPanXRPgfwys93zpBG8A@mail.gmail.com>

Hi,

I spotted what looks like another(*) mistake in 'R Language
Definition' on how subsetting should work.  In Section 'Indexing
matrices and arrays'
[http://cran.r-project.org/doc/manuals/r-release/R-lang.html#Indexing-matrices-and-arrays]
one can read

   "Negative indices are not allowed in indexing matrices."

but this is not true, e.g.

> x <- matrix(1:12, nrow=4)
> x
     [,1] [,2] [,3]
[1,]    1    5    9
[2,]    2    6   10
[3,]    3    7   11
[4,]    4    8   12

> x[c(-2,-4),]
     [,1] [,2] [,3]
[1,]    1    5    9
[2,]    3    7   11

/Henrik

(*) https://stat.ethz.ch/pipermail/r-devel/2015-May/071091.html [docs
have been fixed]



[Rd] R Language Definition: Subsetting matrices with negative indices is *not* an error
Henrik Bengtsson