This is not a Rcpp solution but be advise that as long as your function
"ma" do not require values on previous lines, you might want to look at the
data.table package. This package provides ultra fast operations on
data.frames.
Off course nothing prevents you from writing "ma" in C/C++ and to use
d
Hello,
Storing the data frame as a vector> feels very inefficient,
in essence you are copying all the data to another structure, which is
not much easier to use anyway. The fun implementation feels boiler plate :
int fun(MyRow row) {
return
boost::get<0>(row)+2*boost::get<1>(row)+3*boost::
This can be done more generally.
Following an earlier suggestion from Romain, we can use boost::tuple from the
BH package - for a row of fixed size with general types. Then we can use a
template to read in the data-frame and work with the set of rows.
Variadic templates would be nice here, rat
Le 27/09/13 12:11, sky Xue a écrit :
Hello,
I have a list below whose elements are data frames (Please see the
attached file “try.dat”). Now I want to apply a complicated function to
each row of the data frame which returns a single value. For simplicity,
you can assume this function is ma(x)