-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
match_on.function() expects its first argument to be a function with 3 arguments, index, data and z. But in many cases, including each of my uses of it as well as the example discussed inline in the documentation, only the first two are used. This adds a disorienting element to our explanation:
...This may sound complicated, but is simple to use. For example, a function that returned the absolute difference between two units using a vector of data would be
f <- function(index, data, z) { abs(data[index[,1]] - data[index[,2]]) }.
- I suspect that we could simply do without the
z=argument. - Alternatively, I'd think we could accommodate functions passed to
match_on()that either do or do not take az=argument, provided that we insist they takeindexanddataarguments. In particular, before this point inmakedist.R
dists <- distancefn(cbind(treatmentids, controlids), data, z)we check whether any(names(formals(distancefn))=="z") and if not then instead do
dists <- distancefn(cbind(treatmentids, controlids), data)Either way this is an API change appropriate to a major version bump (#134) .
Reactions are currently unavailable