Skip to content
Prev 856 / 10988 Next

[Rcpp-devel] sugar version of apply

Hello,

Now that we have extended sugar so that it can deal with matrices, e.g :

signature( x = "numeric", y = "numeric" ),
				'
				NumericVector xx(x) ;
				NumericVector yy(y);
				NumericMatrix m = outer( xx, yy, std::plus<double>() ) ;
				return m ;
				'		)



I'd like to have a sugar version of apply. We cannot retain the same 
interface :

apply( { matrix expression }, { 1 or 2 }, { function } )

because we need compile time dispatch, which is not possible with the 
second argument. So I'm just wondering how we should call the row and 
column versions:

apply_1
apply_2
apply_row
apply_col
col_apply
row_apply

Any preference ?

Romain