【发布时间】:2016-12-12 20:01:56
【问题描述】:
当我使用 read.csv 并使用 encoding 参数读取我的 csv 文件时,我会在其中得到一些值。
application <- read.csv("application.csv", na.strings = c("N/A","","NA"), encoding = "UTF-8")
数据集看起来像
X Y
Met<U+00A0>Expectations Met<U+00A0>Expectations
Met<U+00A0>Expectations Met<U+00A0>Expectations
NA Met<U+00A0>Expectations
Met<U+00A0>Expectations Exceeded Expectations
Did<U+00A0>Not Meet Expectations Met<U+00A0>Expectations
Unacceptable Exceeded Expectations
如何从这些值中删除 ?如果我不使用“编码”参数,当我在闪亮的应用程序中显示这些值时,它会被视为:
Met<a0>Expectations and Did<a0>Not Meet Expectations
我不知道如何处理。
PS:我已经用所面临问题的示例修改了原始问题。
【问题讨论】:
-
如果它只是一个额外的列。在名称中,您可以运行类似这样的内容来替换 .带空格
sub("\\."," ",dataframe$column) -
@Kristofersen:问题不在于列名,而在于每列中的值。我已经编辑了这篇文章并提供了更多信息。
-
抱歉,该代码实际上适用于该列。只需将 dataframe 替换为您的数据框名称,并将 column 替换为您的列名称和 all 。将替换为空格。
-
@Kristofersen 对不起,我能明白你的意思,但我在问这个问题时并不清楚。我添加了一个问题的例子,并保持问题简单。当我使用“编码”作为参数时,我在某些值中得到 。我希望从数据集中删除这些。