Skip to content

[Rcpp-devel] Negative indexing in Rcpp

2 messages · Tiago Fragoso, Dirk Eddelbuettel

#
Hello,

Say I have a 10x10 matrix A. If I want to access everything remaining after
I delete columns 1, 5 and 10, all I have to do is

A[,-c(1,5,10)]

Is there a convenient way to do it in Rcpp (or using Armadillo objects)?

Best regards,

Tiago
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130401/a1818ef5/attachment.html>
#
Hi Tiago,
On 1 April 2013 at 17:41, Tiago Fragoso wrote:
| Say I have a 10x10 matrix A. If I want to access everything remaining after I
| delete columns 1, 5 and 10, all I have to do is?
| 
| A[,-c(1,5,10)]
| 
| Is there a convenient way to do it in Rcpp (or using Armadillo objects)?

Armadillo allows you to subset via vector expressions.

Dirk