How to remove strange characters using gsub in R?

前端 未结 2 866
不思量自难忘°
不思量自难忘° 2020-12-06 07:50

I\'m trying to clean up some text that was loaded into memory using readLines(..., encoding=\'UTF-8\').

If I don\'t specify the encoding, I see all kind

2条回答
  •  不思量自难忘°
    2020-12-06 08:38

    The easiest way to get rid of these characters is to convert from utf-8 to ascii:

    combined_doc <- iconv(combined_doc, 'utf-8', 'ascii', sub='')
    

提交回复
热议问题