I'm trying to code quantile normalization without using any fancy functions
(e.g., normalizeBetweenArrays(), normalize.quantities(), etc.). I'm having a
hard time trying to re-order the columns of my means matrix to match the
original unsorted matrix. I assume I will have to somehow utilize order() or
rank() but I'm having a hard time doing so. I'm essentially attempting to
mirror what is being performed on the third slide of page seven of this
(http://www.biostat.jhsph.edu/~ririzarr/Teaching/688/normalization.pdf)
lecture. I've posted below my current code:

samp <- cbind(samp1, samp2, samp3, samp4)
colnames(samp) <- c("samp1", "samp2", "samp3", "samp4")

samp.sorted <- apply(samp, 2, sort) 

row.means <- rowMeans(samp.sorted, na.rm = FALSE)
row.means <- as.matrix(row.means)
row.means <- cbind(row.means, row.means, row.means, row.means)

Any help would be greatly appreciated. 



--
View this message in context: 
http://r.789695.n4.nabble.com/Quick-help-needed-in-coding-quantile-normalization-tp4679072.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

Reply via email to