错误:找不到对象'len'

时间:2016-03-01 06:44:26

标签: javascript jquery r loops programming-tools

我想提供更多信息。我从4个基因开始,使用以下脚本定义了它们的开启和关闭条件:

Proli <- function (DISC1, GSK3B, DIXDC1, CTNNB1){     
  inputs <- permutations(2,4,v=c(0,1),repeats.allowed=TRUE);
  if (DISC1 == 1 && GSK3B == 0 && DIXDC1 == 1 && CTNNB1 == 1){
    Proliferation <- "TRUE"  
  }
  else
  {
    Proliferation <- "FALSE"
  }
  Proliferation
}

然后我加载了gtoolsheirpart

inputs <- permutations(2,26,v=c(0,1),repeats.allowed=TRUE)
len <- length[inputs]
for(i in 1:len) 
{
  if(inputs[i,1] == 1 && inputs[i,2] == 0 && inputs[i,3] == 1 && inputs[i,4] == 1){
    #Constructing  a Truth Table
    output[i] <- 1
  }
  else{
    output[i] <- 0
  }
}

现在我输出[i]&lt; - 0:对象'输出'未找到

时出错

1 个答案:

答案 0 :(得分:-1)

#just添加到您的脚本

len <- lenght(object on with you do your loop)

len <- nrow(object on with you do your loop)



for(i in 1:len) {
        if(inputs[i,1] == 1 && inputs[i,2] == 0 && inputs[i,3] == 1 && inputs[i,4] == 1){
            #Constructing  a Truth Table
            output[i] <- 1
        }
        else{
            output[i] <- 0
        }
    }