Re: [Rcpp-devel] broken package after udpate

2012-11-16 Thread Dirk Eddelbuettel
On 17 November 2012 at 16:18, baptiste auguie wrote: | I've tested my package with the latest Rcpp svn commit (3987) on r-forge and | that fixes it. I'm therefore keen to just wait for the next Rcpp release; I'll | write the CRAN maintainers to see what they want to do with temporarily broken | cd

Re: [Rcpp-devel] broken package after udpate

2012-11-16 Thread baptiste auguie
I've tested my package with the latest Rcpp svn commit (3987) on r-forge and that fixes it. I'm therefore keen to just wait for the next Rcpp release; I'll write the CRAN maintainers to see what they want to do with temporarily broken cda in the meantime. Thanks again for the very responsive help,

Re: [Rcpp-devel] Feedining an IntegerVector into Rcout?

2012-11-16 Thread Dirk Eddelbuettel
On 16 November 2012 at 23:28, Søren Højsgaard wrote: | Dear list, | | Sorry for a trivial question: I have created the function below which calls "match" on each vector in a list and returns the result as a list. The function does what I want it to, but I am puzzled by this: | | + IntegerVecto

Re: [Rcpp-devel] broken package after udpate

2012-11-16 Thread Dirk Eddelbuettel
On 17 November 2012 at 01:06, Romain Francois wrote: | | Le 17/11/12 00:59, baptiste auguie a écrit : | > I see, thanks a lot for tracking this down. Seconded -- nicely done. | > In practical terms, should I change all such functions to use SEXP + | > explicit wrap, or will you submit a new CRA

Re: [Rcpp-devel] broken package after udpate

2012-11-16 Thread Romain Francois
Le 17/11/12 00:59, baptiste auguie a écrit : I see, thanks a lot for tracking this down. In practical terms, should I change all such functions to use SEXP + explicit wrap, or will you submit a new CRAN version soon enough fixing this? I don't know. Personally I don't mind waiting a bit for

Re: [Rcpp-devel] broken package after udpate

2012-11-16 Thread baptiste auguie
I see, thanks a lot for tracking this down. In practical terms, should I change all such functions to use SEXP + explicit wrap, or will you submit a new CRAN version soon enough fixing this? Personally I don't mind waiting a bit for the CRAN fix of cda; probably noone else uses my package and I'd r

Re: [Rcpp-devel] broken package after udpate

2012-11-16 Thread Romain Francois
This is about one of C++ most annoying things. order of includes. To make it short, the function that is responsible for making an R object out of the returned arma::mat is module_wrap, which calls wrap, Where module_wrap is currently written, it does not "see" the wrap() overloads from Rcppp

Re: [Rcpp-devel] Feedining an IntegerVector into Rcout?

2012-11-16 Thread Romain Francois
This is not implemented. You can use Rf_PrintValue( out ) which prints just like R's print. Le 17/11/12 00:28, Søren Højsgaard a écrit : Dear list, Sorry for a trivial question: I have created the function below which calls "match" on each vector in a list and returns the result as a list. Th

[Rcpp-devel] Feedining an IntegerVector into Rcout?

2012-11-16 Thread Søren Højsgaard
Dear list, Sorry for a trivial question: I have created the function below which calls "match" on each vector in a list and returns the result as a list. The function does what I want it to, but I am puzzled by this: + IntegerVector out = R_match(wrap(ee), V_); + Rcout << out << std::endl; whi

Re: [Rcpp-devel] broken package after udpate

2012-11-16 Thread Dirk Eddelbuettel
On 17 November 2012 at 11:31, baptiste auguie wrote: | Hi, | | (Hopefully this makes it to the list; I believe I've had problems reaching it | because of a recent change between @gmail and @googlemail). Looks like it. | I made a minimal package * to illustrate the problem of my recently broken

Re: [Rcpp-devel] Fwd: latest incompatible changes for package developers?

2012-11-16 Thread Romain Francois
Le 16/11/12 23:51, baptiste auguie a écrit : Hi Romain, Dirk, all, Thanks for the quick replies. I think the list problem was due to a change in my gmail address (from "googlemail"); still puzzling that I didn't get a warning. Hopefully someone can figure out why a function that returned an arm

Re: [Rcpp-devel] Fwd: latest incompatible changes for package developers?

2012-11-16 Thread baptiste auguie
Hi Romain, Dirk, all, Thanks for the quick replies. I think the list problem was due to a change in my gmail address (from "googlemail"); still puzzling that I didn't get a warning. Hopefully someone can figure out why a function that returned an arma matrix has now become a vector: I've posted a

Re: [Rcpp-devel] Fwd: latest incompatible changes for package developers?

2012-11-16 Thread Romain Francois
First time I see this email. Sorry your package does not work. R CMD check --no-vignettes worked. (this is how I tested), but indeed something in the vignette makes it crash. I guess I should check the vignettes too :/ I get an error in demo(dimer_linear) regarding something that does not l

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-16 Thread Romain Francois
Le 16/11/12 18:03, Hadley Wickham a écrit : Ouch. Simon wins: expr minlqmedianuq max 1 fmatch(xx, letters) 59.4727 60.29989 74.18049 77.94288 112.2938 2 match__(xx, letters) 137.3878 137.77486 138.33766 152.14018 193.3748 3 match_(xx, letter

Re: [Rcpp-devel] "const" not allowed for Matrix arguments?

2012-11-16 Thread Romain Francois
I've tried to be better about const-ness in revision 3986. Please keep investigating. Thanks. Romain Le 16/11/12 19:53, Ramon Diaz-Uriarte a écrit : More on const arguments: the first will compile and work, the second will not compile, even if we do not modify anything. As far as I can tell

[Rcpp-devel] "const" not allowed for Matrix arguments?

2012-11-16 Thread Ramon Diaz-Uriarte
More on const arguments: the first will compile and work, the second will not compile, even if we do not modify anything. As far as I can tell, in this case the culprit is related to having the reference to the Column, because f3 does compile and work. I guess the problem is the "*this", returne

Re: [Rcpp-devel] inline plug-in linking

2012-11-16 Thread Dirk Eddelbuettel
Wow, that was terrible. Once again, now proofread and edited. On 16 November 2012 at 08:50, JJ Allaire wrote: | Anyhow, I think I am probably missing some linking info from my | inlinePlugIn statement. | | | This is the key -- plugins that do linking are much more complicated than ones

Re: [Rcpp-devel] inline plug-in linking

2012-11-16 Thread Dirk Eddelbuettel
On 16 November 2012 at 08:50, JJ Allaire wrote: | Anyhow, I think I am probably missing some linking info from my | inlinePlugIn statement. | | | This is the key -- plugins that do linking are much more complicated than ones | that rely on headers only. You can look at the Rcpp and RcppG

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-16 Thread Hadley Wickham
> Ouch. Simon wins: > > expr minlqmedianuq max > 1 fmatch(xx, letters) 59.4727 60.29989 74.18049 77.94288 112.2938 > 2 match__(xx, letters) 137.3878 137.77486 138.33766 152.14018 193.3748 > 3 match_(xx, letters) 147.7115 148.36442 149.20221 162.

Re: [Rcpp-devel] inline plug-in linking

2012-11-16 Thread JJ Allaire
> > Anyhow, I think I am probably missing some linking info from my > inlinePlugIn statement. > This is the key -- plugins that do linking are much more complicated than ones that rely on headers only. You can look at the Rcpp and RcppGSL packages as examples -- in short there needs to be a functi

[Rcpp-devel] inline plug-in linking

2012-11-16 Thread Ian Fellows
Hi All, I'm attempting to get inline up and running for my package, but am having some trouble. My plug in statement is: inlineErnmPlugin <- Rcpp:::Rcpp.plugin.maker( include.before = "#include ", libs = "", package= "ernm" ) T

Re: [Rcpp-devel] setdiff

2012-11-16 Thread Romain Francois
Le 16/11/12 16:52, Dirk Eddelbuettel a écrit : On 16 November 2012 at 09:36, Hadley Wickham wrote: | > | I've been using (e.g.) http://www.cplusplus.com/reference/stl/map/ a | > | lot - it has plenty of examples, which is really helpful for getting | > | started. | > | > It seems that site has a

Re: [Rcpp-devel] setdiff

2012-11-16 Thread Dirk Eddelbuettel
On 16 November 2012 at 09:36, Hadley Wickham wrote: | > | I've been using (e.g.) http://www.cplusplus.com/reference/stl/map/ a | > | lot - it has plenty of examples, which is really helpful for getting | > | started. | > | > It seems that site has a bit of an uncool reputation among the cognoscent

Re: [Rcpp-devel] setdiff

2012-11-16 Thread Hadley Wickham
> | I've been using (e.g.) http://www.cplusplus.com/reference/stl/map/ a > | lot - it has plenty of examples, which is really helpful for getting > | started. > > It seems that site has a bit of an uncool reputation among the cognoscenti on > SO. So you're saying it's good? ;) > I usually go bac

Re: [Rcpp-devel] Debugging Rcpp code

2012-11-16 Thread Hadley Wickham
> You might like to di something like: > > std::vector< std::vector > groups( max(i) ) ; > > you'll pay for the traversal of the max, but then you don't need to resize. I ended up going with: NumericVector tapply3(NumericVector x, IntegerVector i, Function fun) { std::map > groups; NumericVe

Re: [Rcpp-devel] setdiff

2012-11-16 Thread Dirk Eddelbuettel
On 16 November 2012 at 09:22, Hadley Wickham wrote: | > | Cool - thanks! It might be useful in general to expose some of the | > | STL sorted range commands - I'm not sure if that's general enough for | > | base Rcpp or not. | > | > Even having really good documentation on all the STL goodness wo

Re: [Rcpp-devel] Debugging Rcpp code

2012-11-16 Thread Romain Francois
That's the one; You might like to di something like: std::vector< std::vector > groups( max(i) ) ; you'll pay for the traversal of the max, but then you don't need to resize. Calling fun() is going to be costly too (probably what will dominate). specially because of our internal::try_catch

Re: [Rcpp-devel] setdiff

2012-11-16 Thread Hadley Wickham
> | Cool - thanks! It might be useful in general to expose some of the > | STL sorted range commands - I'm not sure if that's general enough for > | base Rcpp or not. > > Even having really good documentation on all the STL goodness would be good. > There is an entire chapter in (free, pdf and oth

Re: [Rcpp-devel] setdiff

2012-11-16 Thread Dirk Eddelbuettel
On 16 November 2012 at 06:54, Hadley Wickham wrote: | Cool - thanks! It might be useful in general to expose some of the | STL sorted range commands - I'm not sure if that's general enough for | base Rcpp or not. Even having really good documentation on all the STL goodness would be good. There

Re: [Rcpp-devel] Debugging Rcpp code

2012-11-16 Thread Hadley Wickham
Ooops, I completely misinterpreted the std::vector API. To insert the elements I need to do: for(x_it = x.begin(), i_it = i.begin(); x_it != x.end(); ++x_it, ++i_it) { int i = *i_it; if (i > groups.size()) { groups.resize(i); } groups[i - 1].push_back(*x_it); } Hadley

[Rcpp-devel] Debugging Rcpp code

2012-11-16 Thread Hadley Wickham
Hi all, I'm attempting to write a simple version of tapply in C++ (see attached). However, when I run tapply2(1, 1, sum) (which should return 1), R segfaults. If I run R with gdb, I get the following stack trace: #0 0x03942120 in tapply2 (x=@0xbfffda68, i=@0xbfffda58, fun=@0xbfffda50) at tappl

[Rcpp-devel] changing a "const" argument

2012-11-16 Thread Ramon Diaz-Uriarte
Dear All, I thought something like this would fail (would not compile): // [[Rcpp::export]] double changeAVector(const NumericVector a) { a[0] = 3.0; return 44.0; } But it does compile OK, and it really does modify the argument: d1 <- c(93, 99); changeAVector(d1); d1 Is this expected

Re: [Rcpp-devel] Missing values

2012-11-16 Thread Hadley Wickham
>> I guess we could come up with a nicer syntax for these, maybe static >> functions in Vector<> so that we could do : >> >> IntegerVector::is_na( ) >> NumericVector::get_na( ) >> ... > > > commmited in rev 3979. I don't want to flog a dead horse, but one of the things I like about github is how e

Re: [Rcpp-devel] Missing values

2012-11-16 Thread Romain Francois
Le 16/11/12 14:00, Hadley Wickham a écrit : On Fri, Nov 16, 2012 at 2:25 AM, Romain Francois wrote: Thanks for exploring these issue. This looks very useful. I get: str( first_log(NA) ) logi TRUE str( first_int(NA_integer_) ) int NA str( first_num(NA_real_) ) num NA str( first_ch

Re: [Rcpp-devel] Missing values

2012-11-16 Thread Hadley Wickham
On Fri, Nov 16, 2012 at 2:25 AM, Romain Francois wrote: > Thanks for exploring these issue. This looks very useful. > > I get: > >> str( first_log(NA) ) > logi TRUE >> str( first_int(NA_integer_) ) > int NA >> str( first_num(NA_real_) ) > num NA >> str( first_char(NA_character_) ) > chr "NA" >

Re: [Rcpp-devel] setdiff

2012-11-16 Thread Hadley Wickham
> I've commited an initial version of setdiff. Cool - thanks! It might be useful in general to expose some of the STL sorted range commands - I'm not sure if that's general enough for base Rcpp or not. > There is room for improvement given the R version: > >> setdiff > function (x, y) > { >

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-16 Thread Darren Cook
> I agree that we might want to have these things in a package say RcppBase. > Then Rcpp can remain the R to cpp layer. And anybody who want to implement > an R base function in cpp, can contribute it to RcppBase. Sounds like a good idea, except for the naming (which makes it sound like the Rcpp b

Re: [Rcpp-devel] Missing values

2012-11-16 Thread Romain Francois
Thanks for exploring these issue. This looks very useful. I get: > str( first_log(NA) ) logi TRUE > str( first_int(NA_integer_) ) int NA > str( first_num(NA_real_) ) num NA > str( first_char(NA_character_) ) chr "NA" For first_log: a bool can either be true or false. In R logical vectors

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-16 Thread Willem Ligtenberg
I agree that we might want to have these things in a package say RcppBase. Then Rcpp can remain the R to cpp layer. And anybody who want to implement an R base function in cpp, can contribute it to RcppBase. Willem On Fri, Nov 16, 2012 at 8:56 AM, Romain Francois wrote: > We need to fond the ri