I am trying to replace my code that has double for one with double lapply in order to optimize the program since r works in matrix form, it works like this:
k<-1
for(i in 1:nrow(tab1)){
for(j in 1:nrow(tab2)){
tab3$col1[k]<-tab1$col1[i]
tab3$col2[k]<-tab2$col3[j]
k<-k+1
}
}
I would like it to stay that way, but I do not know how to do it can help? Thanks
lapply(1:nrow(tab1),fuction(i){
lapply(1:nrow(tab2), function(j){
??????????
})
})