Skip to content
Prev 274776 / 398506 Next

calculating ratios from all combinations

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[!idxZeros] # Keep only those rows without zeros
if (!idxZeros[length(idxZeros)]) n <- n[-length(n)] # Throw out last
column as well if needed (i.e., if last column had no zeros)

Though you'll want to tweak it to make it fit your specific problem.

Michael
On Tue, Oct 18, 2011 at 9:20 AM, 1Rnwb <sbpurohit at gmail.com> wrote: