[R] calculating ratios from all combinations

1Rnwb sbpurohit at gmail.com
Mon Oct 17 19:39:12 CEST 2011


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.



More information about the R-help mailing list