Dear Rcppusers,
I can't figure out what the following codes do:
int f4(Function pred, List x) {
int n = x.size();
for(int i = 0; i < n; ++i) {
LogicalVector res = pred(x[i]);
if (res[0]) return i + 1;
}
return 0;
}
I investigated it, and understand applying a function to everypart of a list
then return a LogicalVector, but i can't understand
if the first element of the LogicalVector is true then return the row index of
the list.
Tks!
--
PO SU
mail: [email protected]
Majored in Statistics from SJTU
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.