本文介绍了处理特殊字符,例如R中的口音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将名称中的网页内容抓取到数据框中

I am doing some web scraping of names into a dataframe

对于诸如TomášRosický这样的名称,我得到的结果是TomášRosický

For a name such as "Tomáš Rosický, I get a result "Tomáš Rosický"

我尝试了

Encoding("Tomáš Rosický") #  with latin1 response

,但不确定从何处获得带有重音符号的原始名称。玩过iconv却没有成功

but was not sure where to go from there to get the original name with accents back. Played around with iconv without success

我很满意(甚至可能更喜欢) Tomas Rosicky的输出

I would be satisfied (and might even prefer) an output of "Tomas Rosicky"

推荐答案

您已经阅读了以UTF-8编码的页面。如果 x 是您的姓名栏,请使用 Encoding(x)<- UTF-8

You've read in a page encoded in UTF-8. if x is your column of names, use Encoding(x) <- "UTF-8".

这篇关于处理特殊字符,例如R中的口音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 07:25