R:列表元素中的符号在打印整个列表时不同,与仅打印元素时相比

时间:2018-04-13 14:57:51

标签: r regex special-characters

好吧,这有可能被真正的贬低,因为我不可能在这里重现任何代码,但是这里有:

我有一个数据框列表。当我得到其中一个数据帧的一列时,我会得到最后一行:

mylist[[7]][2]

enter image description here

你看到等号吗?如果我只想看到第135个元素,我得到:

mylist[[7]][135,2]

enter image description here

另外,我无法匹配" "符号与gsub。它只是找不到它:

> gsub("≤","test",mylist[[7]][135,2])
[1] "151≤"
>

> gsub("=","test",mylist[[7]][135,2])
[1] "151≤"

修改

> x <- mylist[[7]][135,2]
> dput(x)
"151="
> 

EDIT2

> Encoding(rs[[7]][135,2])
[1] "UTF-8"



 Encoding(unlist(rs[[7]][2],use.names=F)
...
    [121] "unknown" "unknown" "unknown" "unknown" "unknown" "unknown" "unknown" "unknown"
    [129] "unknown" "unknown" "unknown" "unknown" "unknown" "unknown" "UTF-8"  

编辑3

> library(stringi)
> stri_escape_unicode(mylist[[7]][135,2])
[1] "151\\u2264"
> 

0 个答案:

没有答案