2021年4月29日星期四

Extract non English characters, except white spaces from author names in R

I have the following data:

authors <- c("Fernando Carré", "Adrüne Coça", "Pìso Därço")  

And I want to extract non-english characters and convert them into ASCII, but without the spaces. This is what I have tried:

gsub("[^[:alnum:]]","",authors)  

But it returns:

[1] "FernandoCarré" "AdrüneCoça"    "PìsoDärço"   

It should return:

"Fernando Carre" "Adrune Coca", "Piso Darco"  

Any help will be greatly appreciated.

https://stackoverflow.com/questions/67326791/extract-non-english-characters-except-white-spaces-from-author-names-in-r April 30, 2021 at 08:42AM

没有评论:

发表评论