[BioC] how to use pData output to select columns from an exprset object?

Ochsner, Scott A sochsner at bcm.tmc.edu
Fri Dec 16 17:45:56 CET 2005


Hello,
 
In the following code how would I get R to search the pData slot of z in order to select which columns to average?  I can easily write "1:4" to select the columns but I would like to make this function more generic.  In addition, if anyone can clean up the following code or point me to an easier way
to do this I would greatly appreciate it.
 
thanks,

where dataset=normalized and modeled expression set; z=exprs(dataset)
avg<-function(z){
x<-length(rownames(z))
y<-length(unique(pData(eset)))
ii<-0
means<<-array(dim=c(x,y))
ans<-array(dim=c(x,y))
while (ii<x){
ii<-(ii+1)
means[ii,]<<-c(mean(z[ii,1:2]),mean(z[ii,3:4]))
ans<-means
}}

Scott A. Ochsner, Ph.D.
Baylor College of Medicine
One Baylor Plaza, N810
Houston, TX. 77030
lab phone:  713-798-1620
office phone:  713-798-1585
fax:  713-798-4161



More information about the Bioconductor mailing list