Compare two sets to get the number of unique and common elements in each set
compare_sets.Rd
This function takes in two vectors and returns the number of overlapping elements, along with the number of unique elements. The function can compare sets of characters, numerics, and dates.
Usage
compare_sets(x, y, dates = FALSE, orders = c("ymd", "ymd HM", "ymd HMS"))
Arguments
- x
(
vector
)
The first set to be compared- y
(
vector
)
The second set to be compared- dates
(
logical
)
If set to TRUE, will attempt to convert x & y into dates, and then compare. Set to FALSE by default.- orders
(
vector
)
Allows user to specify potential date or date-time formats they would like to compare. The function will check for"ymd"
,"ymd HM"
, and"ymd HMS"
by default.For example, users can set
orders = "dmy"
to compare vectors indmy
format.