Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.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_Encoding_Utf 8_Emoji_Iso 8859 1 - Fatal编程技术网

R语言中的表情符号编码

R语言中的表情符号编码,r,encoding,utf-8,emoji,iso-8859-1,R,Encoding,Utf 8,Emoji,Iso 8859 1,这是我第一次处理包含表情符号的文本,所以我的问题可能很基本,但我还没有找到解决方案 我在Android上从WhatsApp导出了一个.txt文件,并发送到我的电脑(Windows)。数据如下所示: chat <- c("05.10.17, 22:55 - Person A: Hey, whats up? 😳😄","05.10.17, 22:55 - Person A: I heard about your problem 😅🙄😂","05.10.17, 22:

这是我第一次处理包含表情符号的文本,所以我的问题可能很基本,但我还没有找到解决方案

我在Android上从WhatsApp导出了一个.txt文件,并发送到我的电脑(Windows)。数据如下所示:

chat <- c("05.10.17, 22:55 - Person A: Hey, whats up? 😳😄","05.10.17, 22:55 - Person A: I heard about your problem 😅🙄😂","05.10.17, 22:56 - Person B: What? From whom?🙈","05.10.17, 22:57 - Person A: Your mom...","05.10.17, 22:59 - Person B: ðŸ˜ðŸ˜„","05.10.17, 22:59 - Person B: ðŸ˜ðŸ˜„")
chat
[1] "05.10.17, 22:55 - Person A: Hey, whats up? [[SMILEY1]][[SMILEY2]]"                
[2] "05.10.17, 22:55 - Person A: I heard about your problem [[SMILEY2]][[SMILEY3]][[SMILEY2]]"
[3] "05.10.17, 22:56 - Person B: What? From whom?[[SMILEY3]]"                   
[4] "05.10.17, 22:57 - Person A: Your mom..."                            
[5] "05.10.17, 22:59 - Person B: [[SMILEY2]][[SMILEY2]]"    
[6] "05.10.17, 22:59 - Person B: [[SMILEY2]][[SMILEY2]]"
我想做的是用易于阅读的文本表示法替换表情符号,因此我想要如下内容:

chat <- c("05.10.17, 22:55 - Person A: Hey, whats up? 😳😄","05.10.17, 22:55 - Person A: I heard about your problem 😅🙄😂","05.10.17, 22:56 - Person B: What? From whom?🙈","05.10.17, 22:57 - Person A: Your mom...","05.10.17, 22:59 - Person B: ðŸ˜ðŸ˜„","05.10.17, 22:59 - Person B: ðŸ˜ðŸ˜„")
chat
[1] "05.10.17, 22:55 - Person A: Hey, whats up? [[SMILEY1]][[SMILEY2]]"                
[2] "05.10.17, 22:55 - Person A: I heard about your problem [[SMILEY2]][[SMILEY3]][[SMILEY2]]"
[3] "05.10.17, 22:56 - Person B: What? From whom?[[SMILEY3]]"                   
[4] "05.10.17, 22:57 - Person A: Your mom..."                            
[5] "05.10.17, 22:59 - Person B: [[SMILEY2]][[SMILEY2]]"    
[6] "05.10.17, 22:59 - Person B: [[SMILEY2]][[SMILEY2]]"
我在网上找到了一本词典,将表情符号映射到文本描述,因此我将其导入了R:

# Import the List of all WhatsApp Emojis including their description
Emojis <- read.csv(url("https://raw.githubusercontent.com/iorch/jakaton_feminicidios/master/data/emojis.csv"),header = T, encoding = "UTF-8", stringsAsFactors = FALSE)
Emojis

# Pimp Description for better visibility later on
Emojis[,2] <- paste("[[Emoji:",Emojis[,2], "]]")
Emojis

但是,我的输出看起来完全一样……有人能指出错误吗?

编码的复杂性可能会使粘贴到此处成为共享源代码的非最佳方式。看一看,如果基本的部分在你的系统上起作用,试着把你的聊天日志放在一个可以单独阅读的地方,我可以设计一个更符合你需要的例子。不幸的是,由于保密协议,我无法将聊天日志发布到网上。有没有其他方法可以重现包含所有相关特征的人工示例?但我会看看你的代码,谢谢你的链接!链接中的代码使用来自同一来源的聊天日志,因此它可以正常工作,但编码是很棘手的事情。我完全理解不能共享聊天日志;-)如何加载文本文件?如果使用错误的编码加载,则会丢失数据,并且查找无法工作(您应该在问题中包含加载数据的行),编码的复杂性可能会使粘贴到此处成为共享源的非最佳方式。看一看,如果基本的部分在你的系统上起作用,试着把你的聊天日志放在一个可以单独阅读的地方,我可以设计一个更符合你需要的例子。不幸的是,由于保密协议,我无法将聊天日志发布到网上。有没有其他方法可以重现包含所有相关特征的人工示例?但我会看看你的代码,谢谢你的链接!链接中的代码使用来自同一来源的聊天日志,因此它可以正常工作,但编码是很棘手的事情。我完全理解不能共享聊天日志;-)如何加载文本文件?如果使用错误的编码加载,则会丢失数据,并且查找无法进行(您应该在问题中包含加载数据的行)