narray icon indicating copy to clipboard operation
narray copied to clipboard

Provide function in index arrays?

Open mschubert opened this issue 6 years ago • 0 comments

This refers to indexing as in lambda.r#L14-L19 (multiple arrays, multiple axes, index as data.frame).

Idea:

  • This could be provided as a separate function (analogous to group)
  • The index could be filtered (e.g. to iterate 2 arrays together instead of every combination)
  • lambda could take an index instead of the along argument

Issues:

  • The index wouldn't know necessarily know which axis it was derived from
    • could be solved by adding along attribute to df
    • or wrapping the function call to subset indices (as below)
  • HPC calls like clustermq::Q_rows would not be able to call a function with the indexed object instead of the index of the object
    • instead of just creating the index we could also create a wrapped function call that does the subsetting (would no longer require along attr on df)
    • or lambda could do this if given an index (but how to do custom cmq calls then?)
    • wouldn't this be essentially exporting the wrapper function in lambda?

Proposed solution:

  • Provide indexing function that returns both the index and a function that wraps the call around the index (this way it could be processed by e.g. purrr::pmap, clustermq::Q_rows)
  • lambda/wrapper should work on lists of args instead of row number (so it can be used as a wrapping function and more generalizable for other tools like purrr)
  • lambda/wrapper:simplify shouldn't this all be handled by the same construct call?

mschubert avatar Mar 01 '18 19:03 mschubert