On Sun, Jul 17, 2011 at 11:18 AM, christian krahforst
<ckrahfo...@gmail.com> wrote:
> I have a data frame (gom) or a matrix of trace metal data and some other
> observations from water column samples taken at sea (e.g., 19 samples
> (rows), 19 variables)
> I can calc. the rank individually from each column of the attached object.
> How can I create a matrix that contains the ranked data for each variable
> (either 1-19, ties=avg)?
> For example:
>>gom<-read.csv ("gomdata.csv")
>>rank(Phaeo)
>  [1]  3.5  1.0  2.0  5.0 15.0 19.0 12.0  7.0  3.5 13.0 17.5  9.0  6.0 14.0
> 16.0
> [16] 11.0  9.0  9.0 17.5
>
> I'd like to return an object (e.g., "gomr <-" ) that has each column
> individually ranked (for data normalization, btw).

Try

apply(gom, 2, rank)

HTH,

Peter

______________________________________________
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