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:
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.nabble.com/calculating-ratios-from-all-combinations-tp3912560p3915321.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at 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.