Dear all, The code below is used to generate interval censored data but unfortunately there is an error with the ifelse which i am not able to rectify. Can somebody help correct it for me. Thank you
t<-rexp(20,0.2) v<-c(0,m,999) y<-function(t,v){ z<-numeric(length(t (( s<-numeric(length(t (( for(i in 1:length(t)){ for(j in 1:length(v-1)) { ifelse ((t[i]>v[j] & t< v[j+1] ),{z[i]<-v[j];s[i]<-v[j+1]},NA)}} return(cbind(z,s))} y(t,v) Chris Kelvin Institute for Mathematical Research UPM ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.