how to use pData output to select columns from an exprset object?
1
0
Entering edit mode
Scott Ochsner ▴ 300
@scott-ochsner-599
Last seen 9.6 years ago
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="" <="" div="">
• 861 views
ADD COMMENT
0
Entering edit mode
@kfbargadehues-1528
Last seen 9.6 years ago
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 >
ADD COMMENT

Login before adding your answer.

Traffic: 763 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6