Computes similarity scores between two or more lists of numeric values using multiple comparison methods.
same_number(
...,
method = c("exact", "raw", "exp", "percent", "normalized", "fuzzy"),
epsilon = 0.05,
epsilon_pct = 0.02,
max_diff = NULL,
digits = 3
)
An S3 object containing:
scores
: A list of similarity scores for each method and list pair
summary
: A list of statistical summaries for each method and list pair
methods
: The similarity methods used
list_names
: Names of the input lists
raw_values
: The original input lists
Two or more lists containing numeric values to compare
Character vector specifying similarity methods (default: all)
Threshold for fuzzy matching (default: NULL for auto-calculation)
Relative epsilon percentile (default: 0.02 or 2%). Only used when method is "fuzzy"
Maximum difference for normalization (default: NULL for auto-calculation)
Number of digits to round results (default: 3)
The available methods are:
exact
: Binary similarity (1 if equal, 0 otherwise)
percent
: Percentage difference relative to the larger value
normalized
: Absolute difference normalized by a maximum difference value
fuzzy
: Similarity based on an epsilon threshold
exp
: Exponential decay based on absolute difference (e^-diff)
raw
: Returns the raw absolute difference (|num1 - num2|) instead of a similarity score
nums1 <- list(1, 2, 3)
nums2 <- list(1, 2.1, 3.2)
result <- same_number(nums1, nums2)
Run the code above in your browser using DataLab