How can I increase the speed of the following loop operation? In the code below: DF3= Dataframe OP and k are two columns in DF3 dataframe.
memory.limit(size = 10000000000000)
l1 <- seq(1, 2552, 1)
E<-matrix(data=0, nrow=2552, ncol=2552)
for (i in seq_along(l1)){
for (j in seq_along(l1)){
E[i,j]=sum(ifelse (DF3$OP[DF3$k==i]<DF3$OP[DF3$k==j],1,0))
}
}
Aucun commentaire:
Enregistrer un commentaire