Jaccard distance
jaccard.distance.RdCalculates the Jaccard distance between two vectors OR Calculates the Jacard distance matrix between several vectors The Jaccard distance is the proportion of items that do NOT belong to both sets
Arguments
- x
 A list of values or binary mask, or matrix
- y
 A list of values or binary mask or NULL
- diag
 Whether to include the diagonal of the the distance matrix in output
- upper
 Whether to include the upper triangular part of the matrix in output
Examples
#Binary masks
x <- c(0,1,0,0,0,1,1,1); #1 indicates item belongs to set "x"
y <- c(0,1,0,0,1,0,0,0); #1 indicates item belongs to set "y"
jaccard.distance( x , y );
#> Loading required namespace: vegan
#> Warning: you have empty rows: their dissimilarities may be
#>                  meaningless in method “jaccard”
#> Warning: missing values in results
#>     1   2   3   4   5   6   7
#> 2 1.0                        
#> 3 NaN 1.0                    
#> 4 NaN 1.0 NaN                
#> 5 1.0 0.5 1.0 1.0            
#> 6 1.0 0.5 1.0 1.0 1.0        
#> 7 1.0 0.5 1.0 1.0 1.0 0.0    
#> 8 1.0 0.5 1.0 1.0 1.0 0.0 0.0
#Values
x <- c(7.6,3,6,8,3,1,6);
y <- c(6,7,2,6.5,2,0.12,1);
jaccard.distance( x, y );
#>            1          2          3          4          5          6
#> 2 0.38356164                                                       
#> 3 0.41176471 0.61538462                                            
#> 4 0.06206897 0.36666667 0.44827586                                 
#> 5 0.63235294 0.50000000 0.37500000 0.65517241                      
#> 6 0.91764706 0.88800000 0.86000000 0.92275862 0.77600000           
#> 7 0.48529412 0.69230769 0.12500000 0.51724138 0.50000000 0.84000000