I want to create a single regex or str_detect (if possible) to search through text strings and determine if two words (countries) occur in the same string based on one country list, but testing without repetition. For example:
latam <- c("BRAZIL", "MEXICO", "CHILE", "ARGENTINA", "COLOMBIA", "CUBA", "VENEZUELA", "PERU", "COSTA RICA", "ECUADOR", "URUGUAY", "BOLIVIA", "PARAGUAY", "GUATEMALA", "EL SALVADOR", "PANAMA", "NICARAGUA", "DOMINICAN REPUBLIC", "HONDURAS", "HAITI")
example_string <- c("USA;BRAZIL", "USA;BRAZIL;ARGENTINA", "BRAZIL;BRAZIL;ARGENTINA", "BRAZIL;ARGENTINA", "BRAZIL;BRAZIL", "BRAZIL;BRAZIL;ARGENTINA;ARGENTINA")
Testing example_string, the desired output is: FALSE, TRUE, TRUE, TRUE, FALSE, TRUE.