我在R中有一个包含大量单词的字符串.查看字符串时,我收到大量文本,其中包含类似于以下内容的文本:
>docs
....
\u009cYes yes for ever for ever the boys cried in their ringing voices with softened faces
....
Run Code Online (Sandbox Code Playgroud)
所以我想知道如何从字符串中删除这些\ u009字符(所有字符,其中一些字符略有不同).我尝试过使用gsub(),但是从字符串中删除内容效果不佳.
ags*_*udy 53
这应该工作
gsub('\u009c','','\u009cYes yes for ever for ever the boys ')
"Yes yes for ever for ever the boys "
Run Code Online (Sandbox Code Playgroud)
这里009c是unicode的十六进制数.您必须始终指定4个十六进制数字.如果你有很多,一个解决方案是通过管道将它们分开:
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"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
111493 次 |
| 最近记录: |