narray
narray copied to clipboard
Provide function in index arrays?
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 thealong
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)
- could be solved by adding
- 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 inlambda
?
- instead of just creating the index we could also create a wrapped function call that does the subsetting (would no longer require
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 likepurrr
) -
lambda/wrapper:simplify
shouldn't this all be handled by the sameconstruct
call?