is the vector of indicators for treatment or control
score
is the vector of the propensity scores in the same order as z
replace
a logical value for replace, default is replace=FALSE.
Value
the function returns a vector of indices that the corresponding unit is matched to. 0 means matched to nothing. now also returns a number for each pair making it easier to later recover those pairs.