各种报错数据、字符R处理

报错集锦

2020-01-20  本文已影响0人  养猪场小老板

1、列的数目比列的名字要多

image.png

分析原因:表头列数小于实际列数。如下图


image.png

修改方法:读取的时候去掉表头

> user1rotation2 <- read.csv(“G:\LabRealated\PublicDataset\CPS\data\user1\2\rotationvector.csv”,header = F)

还有一种原因说是:可能是因为文本的编码不是utf-8造成的,解决方法:添加一条fileEncoding = "utf-8"

> user1rotation2 <- read.csv(“G:\LabRealated\PublicDataset\CPS\data\user1\2\rotationvector.csv”,header = T, fileEncoding = "utf-8")

2、分割符缺失

> e1 <- read.table("dang.txt")
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
  line 1 did not have 44 elements
#解决办法,加上分隔符“\t”
> e2 <- read.table("SraRunTable.txt",sep = "\t")

3

> dotplot(ego_cc,title="GO CC Enrichment")
wrong orderBy parameter; set to default `orderBy = "x"`
> pdf(file="CC_dot.pdf",width=10)
> dotplot(ego_cc,title="GO CC Enrichment",orderBy = "GeneRatio")
> dev.off()
image.png
上一篇下一篇

猜你喜欢

热点阅读