【发布时间】:2019-11-20 08:53:48
【问题描述】:
我试图在 R 中加载 .csv。我得到了类似的东西
<f3>?<e9><U+00BC>?<e4><f3> .
我已在全局选项中将默认文本编码设置为 UTF-8。 R 是否可以在导出时特别编码撇号?
df = read.csv("text.csv", encoding="UTF-8",header=TRUE, stringsAsFactors=FALSE)
####Original CSV (Open in Notepad++)####
I don?ó?é¼?äót want
Jes?ÇÖs in the Family
others that wasn?ó?é¼?äót resolved and told
Am really happy with the this ?ƒÿü,
new ?ó?é¼?ôunbreakable?ó?é¼?¥
on the freeway?Ǫ.
####Load in R####
I don?<f3>?<e9><U+00BC>?<e4><f3>t want
Jes?<c7><d6>s in the Family
others that wasn?<f3>?<e9><U+00BC>?<e4><f3>t resolved and told
Am really happy with the this ?<U+0083><ff><fc>
new ?<f3>?<e9><U+00BC>?<f4>unbreakable?<f3>?<e9><U+00BC>?<U+00A5>
on the freeway?<U+01EA>.
####What I want####
Because I don't want
Jes's in the Family
others that wasn't resolved and told
Am really happy with the this ????
new 'unbreakable'
on the freeway….
谢谢。
【问题讨论】:
-
csv文件的编码是什么?
-
你从哪里得出“我想要什么”部分的输出
-
可能与stackoverflow.com/questions/4806823/… 重复请注意
readr包中推荐的guess_encoding参数。可以帮助解决您的问题。底线是您需要找出文件的原始编码。 -
@JdM - 我在 Excel 中打开文件并将其保存为 csv (UTF-8)
-
@MichaelChirico 我想要的输出(将在替换例如 ?ó?é¼?äó 后导出数据)
标签: r utf-8 character-encoding