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

kfbargad@ehu.es kfbargad at ehu.es
Mon Dec 19 17:46:58 CET 2005


Something like the following might help you, although I am sure there 
is a better way.

Index1 <- which(dataset$Name_of_covariate == "Control")

Also, from simpleaffy package you could try:

>Control.dataset <- get.array.subset
(dataset, "Name_of_covariate", "Control")


David

> 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
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
>



More information about the Bioconductor mailing list