Skip to content

shortcut for sapply( seq_len(n) ) #223

@romainfrancois

Description

@romainfrancois

Maybe something like sapply_len and sapply_along so that we could express something like this:

NumericVector out(n) ;
for( int i=0; i<n; i++){
   double val = ... ;
   out[i] = val ;
}

This can be done in sapply with:

NumericVector out = sapply( seq_len(n), [](int i){
    double val = ... ;
    return val ;
}) ;

But this could be useful:

NumericVector out = sapply_len(n, [](int i){
    double val = ... ;
    return val ;
}) ;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions