so here is the code I need help to fix the line for 'st' when it reaches maximum, that's where i am getting stuck.
thanks Sharad set.seed(100) d=data.frame(x=rnorm(20)+5, x1=rnorm(20)+5, x2=rnorm(20)+5, x3=rnorm(20)+5, x4=rnorm(20)+5, x5=rnorm(20)+5, x6=rnorm(20)+5, x7=rnorm(20)+5, x8=rnorm(20)+5) r2=c() cinit=0 for (col in 1:9) { cinit=cinit+1 st=cinit+1 end=dim(d)[2] r=d[,cinit]-d[,st:end] r2=cbind(r2,r) } -- View this message in context: http://r.789695.n4.nabble.com/calculating-ratios-from-all-combinations-tp3912560p3912767.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.