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.
Jeff Newmiller
2013-Oct-26 08:32 UTC
[R] Quick help needed in coding quantile normalization
Couple of problems: 1) The Posting Guide clearly states that this is not a homework help forum. We don't know what rules your study is constrained by, but if you are doing homework then we do know you have resources at your educational institution to rely on. 2) If this is not homework, why the reluctance to rely on tested code? 3) Your code is not reproducible. If we were to be able to assist you, you should be supplying appropriate sample data with which you could demonstrate your problem and desired solution. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. helpwperl <Ssabri1 at jhu.edu> wrote:>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 at 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.