[R] Repeating

efulas ef_ulas at hotmail.com
Mon May 7 11:23:06 CEST 2012


Dear All,


I have a codes which calculates the result of Ripley's K function of my
data. I want to repeat this process 999 times. However, i am getting an
error when i use the "for i in" function. Is there any way to repeat this
analysis 999 times. Here are the codes i used ;


data4 <- matrix(c(sample(id),data1),203,3)

a <- data4[,1]
random.case=data4[a==0,]
random.contr=data4[a==1,]

random.case.locations<-list(x=random.case[,1],y=random.case[,2])
ppregion(xl=min(random.case[,1])-0.0001,xu=max(random.case[,1])+0.0001,yl=min(random.case[,2])-0.0001,yu=max(random.case[,2])+0.0001)
random.l.case <- Kfn(random.case.locations,0.01)

random.k.case <- ((random.l.case$y)^2)/pi
random.contr.locations<-list(x=random.contr[,1],y=random.contr[,2])
ppregion(xl=min(random.contr[,1])-0.0001,xu=max(random.contr[,1])+0.0001,yl=min(random.contr[,2])-0.0001,yu=max(random.contr[,2])+0.0001)
random.l.contr <- Kfn(random.contr.locations,0.01)


random.k.contr <- ((random.l.contr$y)^2)/pi

result <- random.k.case-random.k.contr




Many Thanks

--
View this message in context: http://r.789695.n4.nabble.com/Repeating-tp4614371.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list