Re: [R] calculating ratios from all combinations

2011-10-18 Thread 1Rnwb
thanks for the help and pointer. I am modifying it like this x=which(n[,1]==n[,2]) n=n[-x,] to get rid of combinations which will generate '0' or ratio of 1. Thanks once again. sharad -- View this message in context: http://r.789695.n4.nabble.com/calculating-ratios-from-all-combinations-tp39125

Re: [R] calculating ratios from all combinations

2011-10-18 Thread R. Michael Weylandt
In your code you had a loop over the variable col, but it was never used. Anyways, just modify the line: n <- n[-length(n)] # Throwout unwanted columns to also throw out values with 0's. Perhaps: idxZeros <- apply(d, 1, function(x) any( abs(x-0) < 1e-08)) # Identify rows with zeros n <- n[!idxZ

Re: [R] calculating ratios from all combinations

2011-10-18 Thread 1Rnwb
Thanks Micheal, that's what I wanted, I did not quite catch which variable is unused. Another part is I have my variable values in log scale so it generates '0's' instead of '1', how do i get rid of those cols. Thanks for you patience Sharad -- View this message in context: http://r.789695.n4.n

Re: [R] calculating ratios from all combinations

2011-10-17 Thread R. Michael Weylandt
On Mon, Oct 17, 2011 at 4:31 PM, R. Michael Weylandt wrote: > I have no idea what's going on in the code you provided, particularly > why there are no ratios given your subject line or why you are looping > over an unused variable, but how about this: > > n <- colnames(d) > n <- n[-length(n)] # Th

Re: [R] calculating ratios from all combinations

2011-10-17 Thread 1Rnwb
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=rno