Re: [Rcpp-devel] '[' operator of NumericMatrix

2012-08-22 Thread Dirk Eddelbuettel
On 22 August 2012 at 17:42, Dirk Eddelbuettel wrote: | | On 22 August 2012 at 17:11, Peng Yu wrote: | | Hi, | | | | I'm trying to use '[' operator to extract elements from NumericMatrix. | | But it seems that it is not what I expected. Is it a bug or a feature? | | Neither but mostly your misun

Re: [Rcpp-devel] '[' operator of NumericMatrix

2012-08-22 Thread Dirk Eddelbuettel
On 22 August 2012 at 17:11, Peng Yu wrote: | Hi, | | I'm trying to use '[' operator to extract elements from NumericMatrix. | But it seems that it is not what I expected. Is it a bug or a feature? Neither but mostly your misunderstanding of C syntax carrying forward in C++ as never ever worked i

[Rcpp-devel] '[' operator of NumericMatrix

2012-08-22 Thread Peng Yu
Hi, I'm trying to use '[' operator to extract elements from NumericMatrix. But it seems that it is not what I expected. Is it a bug or a feature? I can use Column to extract columns and then extract elements in each column, which is a tedious solution. Any better solution? Thanks! BTW, where is '

Re: [Rcpp-devel] How to manage testing code for Rcpp based project?

2012-08-22 Thread Hadley Wickham
> devtools on github is still of version 0.7.1. Are you talking about a > branch different from master? In the newer version, when I call > load(), it will automatically compile the C++ code? The version number hasn't been bumped yet, but you'll notice there have been many changes. load_all will

Re: [Rcpp-devel] How to manage testing code for Rcpp based project?

2012-08-22 Thread Peng Yu
Hi Hadley, > The development version of devtools now attempts to compile C, C++ and > fortran code in your src/ directory, and then dynamically link into > your running R session (thanks to hard work by Winston Chang). It's > unlikely to be perfect (or to work for large, complicated projects), >

Re: [Rcpp-devel] Rcpp.package.skeleton(module=TRUE) fails to load

2012-08-22 Thread Davor Cubranic
Hi Florian, I don't see anything different with your package. I could even install the ZIP file you sent me, and saw no errors. Do you get this error consistently when you install? Remember to remove the .o and .so files inside 'mypack' to start with a clean slate. Davor On 2012-08-16, at 12

Re: [Rcpp-devel] Convertion from SEXP to std::vector

2012-08-22 Thread Douglas Bates
On Wed, Aug 22, 2012 at 9:55 AM, Peng Yu wrote: > Hi, > > Rcpp::IntegerVector can not be converted to std::vector. Is > there a class that can help convert SEXP to std::vector? > > The current walkaround can be something like the following. I'm > wondering if there is a better solution? > > Rcpp::

Re: [Rcpp-devel] How to manage testing code for Rcpp based project?

2012-08-22 Thread Douglas Bates
On Wed, Aug 22, 2012 at 12:16 AM, Davor Cubranic wrote: > On 12-08-21 09:54 PM, Darren Cook wrote: RUnit works, but the setup is not the easiest. If someone has ideas for better solutions, by all means implement those. Unit testing has helped us many times, and I consider

[Rcpp-devel] Convertion from SEXP to std::vector

2012-08-22 Thread Peng Yu
Hi, Rcpp::IntegerVector can not be converted to std::vector. Is there a class that can help convert SEXP to std::vector? The current walkaround can be something like the following. I'm wondering if there is a better solution? Rcpp::IntegerVector vec(vx); std::vector v; for (int i=0; ihttps://li

Re: [Rcpp-devel] How to figure out the signature of cxxfunction is a matrix or vector?

2012-08-22 Thread Peng Yu
On Wed, Aug 22, 2012 at 12:20 AM, Davor Cubranic wrote: > On 12-08-21 08:30 PM, Peng Yu wrote: > >> BTW, the pdf document (e.g. Rcpp-introduction.pdf) can not be >> searched correctly in Acrobat (but it can be search correctly in >> skim). For example, if I search for "matri", I will get to "some"

Re: [Rcpp-devel] How to manage testing code for Rcpp based project?

2012-08-22 Thread Hadley Wickham
> Thanks! I did briefly consider testthat, based on reading [1], and > dismissed it because it seemed to be different without being better. > (I'm not saying it was worse, just it didn't appear to have any killer > reason to make it worth turning my back on the 10-15 years worth of > experience the

Re: [Rcpp-devel] How to manage testing code for Rcpp based project?

2012-08-22 Thread Hadley Wickham
> BTW, the test code in RcppArmadillo_0.3.2.4/inst/unitTests can be run > only after RcppArmadillo is installed. For a developer, he/she does > not always want to install the package before he/she can run the test > case. "devtools" solves this problem for pure R package. I'm wondering > if there i