Open grantmcdermott opened 2 weeks ago
That feels like a different type. Maybe something like type_transform(fun)
, where we would check formals(fun)
to see if we should pass it x
, y
, ymin
, ymax
, etc. I can imagine, for example, using this to back-transform confidence intervals, so transforming ymin
might be useful too.
Would have to think about what constraints to impose on input/output. If we go such a flexible route, I think it should be very strict and raise informative errors. Otherwise users will get frustrated with weird messages.
It would be cool if we could do something like:
Where, in this case, you would get lines of the mean weight per Time period. You'd have to check that the resulting object was the same length as the original object, though.
OTOH maybe this should be a separate type function (
type_summary
?) that explicitly guarantees the same length by passing appropriate summary functions toave
. Then you could do things like: