Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从“读取数据时获取不需要的撇号字符”|&引用;(管道)R中的分隔文本文件_R - Fatal编程技术网

从“读取数据时获取不需要的撇号字符”|&引用;(管道)R中的分隔文本文件

从“读取数据时获取不需要的撇号字符”|&引用;(管道)R中的分隔文本文件,r,R,我试图从包含以下格式数据的文本文件中读取数据: 583550348352212992|Thu Apr 02 08:43:39 +0000 2015|Ambulance progress 'not fast enough' http://bbc.in/1P1AJyX 583406140337164288|Wed Apr 01 23:10:37 +0000 2015|Children’s hospital builds sleep app http://bbc.in/1BO9jlZ 我正在使用re

我试图从包含以下格式数据的文本文件中读取数据:

583550348352212992|Thu Apr 02 08:43:39 +0000 2015|Ambulance progress 'not fast enough' http://bbc.in/1P1AJyX
583406140337164288|Wed Apr 01 23:10:37 +0000 2015|Children’s hospital builds sleep app http://bbc.in/1BO9jlZ
我正在使用read.table函数,如下所示:

bbchealth <- read.table(file=".../bbchealth.txt", 
                    sep="|", 
                    header = F, 
                    quote="", 
                    fill=F, 
                    stringsAsFactors = F,
                    numerals ="no.loss",
                    col.names = c("TweetId", "Date and Time", "Tweet"))
如您所见,“Children
s“中的撇号已更改为
€™

无论撇号出现在何处(即使是倒装形式),情况都是如此

读作

574407194961039360 Sun Mar 08 03:12:01 +0000 2015 Frankie the dog ‘sniffs out cancer’ http://bbc.in/1COjVHM
在这里,
被转换成
被转换成

如何确保这些符号按原样读取。

请尝试
read.table()
中的
encoding=“UTF-8”
参数

574407194961039360|Sun Mar 08 03:12:01 +0000 2015|Frankie the dog ‘sniffs out cancer’ http://bbc.in/1COjVHM
574407194961039360 Sun Mar 08 03:12:01 +0000 2015 Frankie the dog ‘sniffs out cancer’ http://bbc.in/1COjVHM