Removing certain characters from a string in R

前端 未结 2 1793
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 10:29

I have a string in R which contains a large amount of words. When viewing the string I get a large amount of text which includes text similar to the following:



        
相关标签:
2条回答
  • 2020-12-10 10:33

    This should work

    gsub('\u009c','','\u009cYes yes for ever for ever the boys ')
    "Yes yes for ever for ever the boys "
    

    Here 009c is the hexadecimal number of unicode. You must always specify 4 hexadecimal digits. If you have many , one solution is to separate them by a pipe:

    gsub('\u009c|\u00F0','','\u009cYes yes \u00F0for ever for ever the boys and the girls')
    
    "Yes yes for ever for ever the boys and the girls"
    
    0 讨论(0)
  • 2020-12-10 10:41

    try: gsub('\\$', '', '$5.00$')

    0 讨论(0)
提交回复
热议问题