[Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Sameer D'Costa
Hi, I am trying to return several Armadillo matrices back to R and to set the names for the rows and the columns of each matrix. I have tried converting each Armadillo matrix to a NumericMatrix and then setting the dimnames on that before returning a list to R. This seems to work (see snippet belo

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Dirk Eddelbuettel
Hi Sameer, On 2 May 2013 at 10:16, Sameer D'Costa wrote: | Hi, | | I am trying to return several Armadillo matrices back to R and to set | the names for the rows and the columns of each matrix. I have tried | converting each Armadillo matrix to a NumericMatrix and then setting | the dimnames on

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Sameer D'Costa
Thanks for the reply Dirk. On Thu, May 2, 2013 at 12:53 PM, Dirk Eddelbuettel wrote: > > Hi Sameer, > > On 2 May 2013 at 10:16, Sameer D'Costa wrote: > | Hi, > | > | I am trying to return several Armadillo matrices back to R and to set > | the names for the rows and the columns of each matrix. I

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Dirk Eddelbuettel
On 2 May 2013 at 14:33, Sameer D'Costa wrote: | Thanks for the reply Dirk. | | On Thu, May 2, 2013 at 12:53 PM, Dirk Eddelbuettel wrote: | > | > Hi Sameer, | > | > On 2 May 2013 at 10:16, Sameer D'Costa wrote: | > | Hi, | > | | > | I am trying to return several Armadillo matrices back to R and t

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Sameer D'Costa
On Thu, May 2, 2013 at 3:06 PM, Dirk Eddelbuettel wrote: > > On 2 May 2013 at 14:33, Sameer D'Costa wrote: > | Thanks for the reply Dirk. > | > | On Thu, May 2, 2013 at 12:53 PM, Dirk Eddelbuettel wrote: > | > > | > Hi Sameer, > | > > | > On 2 May 2013 at 10:16, Sameer D'Costa wrote: > | > | Hi,

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Dirk Eddelbuettel
On 2 May 2013 at 16:37, Sameer D'Costa wrote: | > From a quick look at the header file Matrix.h it seems that | > | > template | > Matrix( const int& nrows_, const int& ncols, Iterator start ) ; | > | > should be what you are after. (The various types are just typedefs to the | > templat

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-02 Thread Dirk Eddelbuettel
On 2 May 2013 at 17:24, Dirk Eddelbuettel wrote: | Sorry. It was just a quick guess. | | On second thought, I think your earlier approach was actually pretty good: | Take your arma object, use wrap to turn it into a SEXP (or maybe an RObject) | and you should then be able to set attributes. An

Re: [Rcpp-devel] Returning Armadillo matrices with dimnames

2013-05-03 Thread Krzysztof Sakrejda
On May 2, 2013 11:22 PM, "Dirk Eddelbuettel" wrote: > > > On 2 May 2013 at 17:24, Dirk Eddelbuettel wrote: > | Sorry. It was just a quick guess. > | > | On second thought, I think your earlier approach was actually pretty good: > | Take your arma object, use wrap to turn it into a SEXP (or maybe a