I am new to r and work on boolean modelling - my nested loop gives output of 50 values of rtk in terms of 0 and 1, how to store this output in a dataframe , cbind is not working . Please help. 2. Also I would like to introduce a time loop ie if j = is 5 seconds I want rtk to change accoding to nwki value in i0 for j =1to 3 and for time j = 4,5 seconds i want rtk to change accoding to nwk value in i0
CODE IS AS FOLLOWS
library (BoolNet)#make sure lib is installed
library(igraph)
setwd("C:/Users/neha gopal/Desktop/IISC-mkj/r for boolean")#"
nwki<- loadNetwork("rtkufi.txt",bodySeparator =",",lowercaseGenes = FALSE)#"
nwk<- loadNetwork("rtkuf.txt",bodySeparator =",",lowercaseGenes = FALSE)#"
inc<-c(1,0,0,0,0,0,0,0,0,0)#vector
stF<- stateTransition(network=nwki,state= inc,type = "asynchronous")
stF
#loops working
rtk_values <-rep(0,50)# empty vector for total no of rtk output values
rtk_values
ts<- 10
for (i in 1:ts)# trajectories i=10
{
i0 <- inc
rtk_values <-rep(0,50)
rtk <- i0[2]
tr<-5 #time j=5
for (j in 1:tr)
{
i0 <- stateTransition(network=nwki,state= i0,type = "asynchronous")
rtk <- i0[2]
print (paste0( ",Im in J and my j is ", j, " and my i is", i,"rtk is" , rtk ))
}
}
#table NOT working
rtk_values[j]= rtk
rtk_table <- cbind.data.frame( rtk_values, rtk)