R语言的字符串分割
while((length(line2))!=0){dna2=strsplit(line2,"\t")if((gene_name[i])==(dna2[255])){pr...
while((length(line2))!=0){
dna2 = strsplit(line2,"\t")
if((gene_name[i])==(dna2[255])){
print(line2)
cat("line2",file=outfile2)
cat("\n",file=outfile2)
}
line2=readLines(con2,n=1)
}
我是读取文件,每行存入line2,然后用\t分割,存入dna2中,但是我运行的时候,总出错,就读取第一行不能进行循环:
Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr, :
length of 'dimnames' [2] not equal to array extent
In addition: Warning message:
In is.na(e2) : is.na() applied to non-(list or vector) of type 'NULL'
这是怎么回事?? 展开
dna2 = strsplit(line2,"\t")
if((gene_name[i])==(dna2[255])){
print(line2)
cat("line2",file=outfile2)
cat("\n",file=outfile2)
}
line2=readLines(con2,n=1)
}
我是读取文件,每行存入line2,然后用\t分割,存入dna2中,但是我运行的时候,总出错,就读取第一行不能进行循环:
Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr, :
length of 'dimnames' [2] not equal to array extent
In addition: Warning message:
In is.na(e2) : is.na() applied to non-(list or vector) of type 'NULL'
这是怎么回事?? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询