Re: [Rcpp-devel] Handling NAs in RcppMatrix

2010-02-07 Thread Dirk Eddelbuettel
On 7 February 2010 at 14:58, [email protected] wrote: | Yes. The new api is our current focus. Right. It is simply 'much newer' so there are more examples for the old API. Which we will not withdraw, and which is less likely to undergo changes, but yes -- the new one is better. | You can

Re: [Rcpp-devel] Handling NAs in RcppMatrix

2010-02-07 Thread francoisromain
Yes. The new api is our current focus. You can find many real examples as part of our unit tests (in the "unitTests" installed directory of the package). Some other examples in our blogs A draft article in the "papers" sub directory of the rforge project of rcpp. -Original Message

Re: [Rcpp-devel] Handling NAs in RcppMatrix

2010-02-07 Thread Leo Alekseyev
D'oh, I should have guessed it was an integer/double issue -- I actually tried to check by testing something like c(1.0:2.2,NA), but this of course still produced an integer. So as a general question -- would you recommend using the new API (Rcpp::CharacterVector, Rcpp::NumericVector) over RcppMat

Re: [Rcpp-devel] Handling NAs in RcppMatrix

2010-02-07 Thread Romain Francois
I've logged this as a bug in Rcpp's bug tracker : https://r-forge.r-project.org/tracker/?atid=637&group_id=155&func=browse Romain On 02/07/2010 10:15 AM, Romain Francois wrote: > Hello, > > I think the problem is that c(1:2, NA) produces an __integer__ vector, > and RcppVector does not take care

Re: [Rcpp-devel] Handling NAs in RcppMatrix

2010-02-07 Thread Romain Francois
On 02/06/2010 11:56 PM, Leo Alekseyev wrote: > Howdy folks, [...] > > On a (probably) unrelated note, I get the following error when > compiling my C++ code: > Error in RcppCxx0xFlags() : could not find function "capture.output" > Calls: -> cat -> RcppCxx0xFlags I think I've fixed this in svn b

Re: [Rcpp-devel] Handling NAs in RcppMatrix

2010-02-07 Thread Romain Francois
Hello, I think the problem is that c(1:2, NA) produces an __integer__ vector, and RcppVector does not take care of coercion properly. > typeof( c(1:2,NA) ) [1] "integer" > typeof( c(1,2,NA) ) [1] "double" The "garbage value" you get I suppose is -2^31, which is how R represents NA for intege