在使用R的if语句中,参数的长度为零

时间:2014-09-08 13:30:35

标签: r

有谁知道如何解决这个问题?

for (x in 1:nrow(homer1)-1) {if ((homer1$Start [x+1] +1) == homer1$End [x]) {homer1$annnot_prom <- paste(homer1$Detailed.Annotation, homer1$Nearest.PromoterID, sep="_") } else {homer1$annnot_prom <- homer1$Detailed.Annotation} }

Error in if ((homer1$Start[x + 1] + 1) == homer1$End[x]) { : 
  argument is of length zero

1 个答案:

答案 0 :(得分:1)

for循环中添加一些括号:

for (x in 1:(nrow(homer1)-1))

相关问题