-2

I like to give little more information. I started with 4 genes and defined their on and off conditions, using the below script:

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
}

then I loaded gtools and heirpart.

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
  }
}

Now I get Error in output[i] <- 0 : object 'output' not found

Munawir
  • 3,346
  • 9
  • 33
  • 51

1 Answers1

-1

#just add on top of your script

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

or

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
        }
    }
M. Siwik
  • 486
  • 7
  • 17