Calculate a weighted distance between two vectors, using pairwise complete observations.
Source:R/vectorWeightedDist.R
vectorWeightedDist.RdSimple function to count the fraction of different elements (in the same position) between two vectors of the same length, after removing elements from both vectors corresponding to positions that are NA in either vector. Distance is the probability for observing the matches and mismatches in two random patients.
Arguments
- x
a matrix
- y
a matrix with the same number of columns as x
- k
row in x to test for differences
- l
row in y to test for differences
- col_freqs_x
optional precomputed list of column value proportions for x (named numeric tables per column)
- col_freqs_y
optional precomputed list of column value proportions for y (named numeric tables per column)