I'm trying to determine if a string is a subset of another string. A possible solution is given by grepl function. For example
X<-"hello"
Y<-"hel"
grepl(Y, X, fixed = TRUE)
returns TRUE. I would like to obtain a similar result also for sentences and not only for single words. In this case:
grepl("John Tolkien", "John Ronald Reuel Tolkien", fixed = TRUE)
grepl("Tolkien John", "John Ronald Reuel Tolkien", fixed = TRUE)
grepl("John Ronald Tolkien", "John Ronald Reuel Tolkien", fixed = TRUE)
return FALSE, but I would like to obtain TRUE because John Tolkien, Tolkien John and John Ronald Tolkien are subsets of John Ronald Reuel Tolkien