I am trying to build a simulator for infectious disease. I pass an index for single infected individual along with the time they got infected. Also the vector of susceptible hosts is given. The infectious period & contact interval are kind of giving which susceptible hosts fall in the network of the infected individual. We pick the minimum contact time to identify the newly infected individuals & then look at the minimum contact times for all susceptibles with all infected at each step. Running this code gives the error : Error in data.frame(..., check.names = FALSE) :

arguments imply differing number of rows: 0, 1

I am not sure where this error is being generated from.

```
i<-1
inf_index<-4
#a<-NULL
susc_index<-c(2,3,1,5)
time_inf<-6
IP<-rexp(length(inf_index),2)
CI<-rexp(length(susc_index),3)
a<-CI<=IP
if(sum(a)==0){
stop("no epidemic")
} else{
time<-timemat<-cbind(expand.grid(inf=inf_index,susc=susc_index[a]),infectious_time
=time_inf+IP,contact_time=time_inf+CI[a])
contact_time<-round(time[,"contact_time"],digits=3)
infectious_time<-time[,"infectious_time"]
cond<-any(contact_time<=max(infectious_time))}
while(cond & length(susc_index)>0){
index<-which.min(contact_time)
infector<-time[index,"inf"]
time_inf<-time[index,"contact_time"]
inf_index<-time[index,"susc"]
susc_index<-susc_index[!susc_index==inf_index]
print(as.matrix(list(infector=infector,infected=inf_index,time_inf=time_inf)))
time<-time[!time$susc==inf_index,] #remove newly infected from matrix
i<-i+1
IP<-c(IP,rexp(1,2)) #generate ip for newly infected & merge the ip for previous person
CI<-rexp(length(susc_index),3) # generate ci with newly infected with susceptible list
a<-CI<=IP[i]
#contact_time<-round(time[,"contact_time"],3)
#infectious_time<-time[,"infectious_time"]
#cat("the while_loop step is now from if =",i,"\n")
timemat<-cbind(expand.grid(inf=inf_index,susc=susc_index[a]),infectious_time
=time_inf+IP[i],contact_time=time_inf+CI[a])
time<-rbind(time,timemat)
#paste("the time matrix step is now from =",time,"\n")
contact_time<-round(time[,"contact_time"],3)
infectious_time<-time[,"infectious_time"]
cond<-any(contact_time<=max(infectious_time))
}
```