Reputation: 125
Suppose that we have a "AMID DIMAD YUZBASIOGLU" string. What I want to do is to match possible strings such as "AMİD YÜZBAŞIOĞLU","AMID YÜZBAŞIOĞLU", "AMID DİMAD YÜZBAŞIOĞLU" with "AMID DIMAD YUZBASIOGLU" using grep function.
Upvotes: 1
Views: 41
Reputation: 61204
We can use iconv(your_string, to='ASCII//TRANSLIT')
to convert special characters to 'ASCII' and then use grep
> x <- "AMID DIMAD YUZBASIOGLU"
> string <- c("AMİD YÜZBAŞIOĞLU","AMID YÜZBAŞIOĞLU","AMID DİMAD YÜZBAŞIOĞLU")
> y <- iconv(string, to='ASCII//TRANSLIT')
> grep(x, y)
[1] 3
Upvotes: 1