I know that, if
s1 <- "string"
s2 <- "String"
the comparison can be done as follows:
# Case-sensitive check
s1 == s2
# Case-insensitive check
tolower(s1) == tolower(s2)
What I have in mind, however, is a different kind of comparison:
s1 <- "John Smith"
s2 <- "Smith John"
If I apply previous code to this example, I obtain FALSE as result. But these two strings are formed by the same words, and I would like to have a comparison that gives, for this example, TRUE.