
Thanks so much Rui. I really appreciate all the help.

I implemented the code and it ran fine. I was wondering how I could include the probeset ids as probeset1:probeset2 in the final output so that I know which ratios are for which probeset pairs.


Thanks so much.
Som.
Date: Sat, 12 May 2012 09:29:54 -0700
From: ml-node+s789695n4629105h16@n4.nabble.com
To: genome1976@hotmail.com
Subject: Re: Calculating all possible ratios



	Hello,


If by all possible gene ratios you mean all pairwise column ratios, try 

the following.


# Make up some data

x <- matrix(1:24, ncol=6)


cmb <- combn(ncol(x), 2)

r1 <- apply(cmb, 2, function(j) x[, j[1]]/x[, j[2]])

r2 <- apply(cmb, 2, function(j) x[, j[2]]/x[, j[1]])

cbind(r1, r2)


Note that the dataset must be a numeric only matrix or data.frame.


Hope this helps,


Rui Barradas


Em 12-05-2012 11:00, [hidden email] escreveu:

> Date: Fri, 11 May 2012 12:39:23 -0700 (PDT)

> From: genome1976<[hidden email]>

> To:[hidden email]

> Subject: [R] Calculating all possible ratios

> Message-ID:<[hidden email]>

> Content-Type: text/plain

>

> I have a data matrix with  genes as columns and samples as rows. I want to

> create all possible gene ratios.Is there an elegant and fast way to do it in

> R and write it to a dataframe?

>

> Thanks for any help.

> Som.

>

> --

> View this message in context:http://r.789695.n4.nabble.com/Calculating-all-possible-ratios-tp4627405.html
> Sent from the R help mailing list archive at Nabble.com.

> 	[[alternative HTML version deleted]]

>

______________________________________________

[hidden email] 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.


	
	

	

	
	
		If you reply to this email, your message will be added to the discussion below:
		http://r.789695.n4.nabble.com/Calculating-all-possible-ratios-tp4627405p4629105.html
	
	
		
		To unsubscribe from Calculating all possible ratios, click here.

		NAML
	 		 	   		  

--
View this message in context: http://r.789695.n4.nabble.com/Calculating-all-possible-ratios-tp4627405p4629358.html
Sent from the R help mailing list archive at Nabble.com.
	[[alternative HTML version deleted]]

