如何在R中将特殊字符转换为unicode? [英] How to convert special characters into unicode in R?

查看:417
本文介绍了如何在R中将特殊字符转换为unicode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在R中进行一些文本数据清除时,我可以找到一些特殊字符。为了摆脱它们,我必须知道它们的unicode,例如€是\u20AC。我想知道是否有可能通过函数将特定字符内的字符串作为输入来查看 Unicode?

When doing some textual data cleaning in R, I can found some special characters. In order to get rid of them, I have to know their unicodes, for example € is \u20AC. I would like to know if it is possible "see" the unicodes with a function that take into account the string within the special character as an input?

推荐答案

请参阅Cath注释, iconv 可以完成以下工作:

Refering to Cath comment, iconv can do the job :

iconv("é", toRaw = TRUE)

然后,您可能想取消列表并粘贴 \u00

Then, you may want to unlist and paste with \u00.

这篇关于如何在R中将特殊字符转换为unicode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆