Dear all,
I have made the following primitive "concatenate" function, because I couldn't
find one in Rcpp:
template
Vector do_conc_(Vector x, Vector y){
int nx=x.size(), n=x.size()+y.size(),i,j;
Vector out=no_init(n);
for (i=0; i ( XX_, YY_ ) ;
case REALSXP : return do_conc_( XX_, YY_ )
Hi Søren,
I like the idea. Currently there is nothing like that in Rcpp. It
could be made more flexible if we:
1. Accept a generic set of vectors that could be appropriately casted as needed,
2. Cast these vectors to the appropriate type if necessary,
3. Fill an output vector with the elements of
Hi,
There is currently nothing like that. It is quite hard to generalize.
You might like std::merge, e.g.
template
Vec do_conc_(Vec x, Vec y){
Vec out=no_init(x.size()+y.size());
std::merge( x.begin(), x.end(), y.begin(), y.end(), out.begin() ) ;
return out;
}
We could want to general
Hi Kevin,
Thanks for your reply. I was only introduced to C++11 last week (my fault!); it
seems that everybodys life becomes much easier once R-packages can be made with
that...
I think many Rcpp-friends would welcome a version of c( ). One view is of
course that it should be as general as R's
Le 22 janv. 2014 à 01:10, Kevin Ushey a écrit :
> Hi Søren,
>
> I like the idea. Currently there is nothing like that in Rcpp. It
> could be made more flexible if we:
>
> 1. Accept a generic set of vectors that could be appropriately casted as
> needed,
> 2. Cast these vectors to the appropri
Hi,
There is a preliminary version of this in Rcpp11. For example:
#include
using namespace Rcpp ;
// [[Rcpp::export]]
NumericVector test(){
NumericVector x(10) ;
NumericVector y(30) ;
return NumericVector::concat(x, 2.0, y, 1.0) ;
}
So it handles (or at least it should):
- compatibl