Hallo,
 I was trying some code, but couldn't make one step of the code properly.
Can anybody  please  help me?

I have one matrix like this
> values
          [,1]       [,2]       [,3]      [,4]      [,5]
[1,] 0.7777778 0.36111111 0.22222222 0.1388889 0.0000000
[2,] 1.0000000 0.00000000 0.53846154 0.0000000 0.5384615
[3,] 0.5200000 0.48000000 0.64000000 0.0000000 0.8800000
[4,] 0.8928571 1.00000000 0.00000000 0.8928571 0.1071429


And I want to get some matrix like:
> values.new
      [,1]  [,2]  [,3]  [,4]  [,5]
[1,] 0.2  0.4  0.6  0.8  1.0
[2,] 0.2  1.0  0.6  1.0  0.6
[3,] 0.6  0.8  0.4  1.0  0.2
[4,] 0.6  0.2  1.0  0.6  0.8


This table should be computed by taking proportion of values in the row that
are larger or equals to the value being considered with the total no of
objects in the row.

for example
> values[1,2]
[1] 0.3611111
and
> values[1,]
[1] 0.7777778 0.3611111 0.2222222 0.1388889 0.0000000 0.8611111
So there are two numbers more than equals to values[1,2]
So
> values.new[1,2]= 2/length(values[1,])



With best regard,
Suparna
----------------------------
Ms Suparna Mitra
Eberhard-Karls-Universität Tübingen
Wilhelm-Schickard-Institut
Algorithmen der Bioinformatik
Sand 14, 72076 Tuebingen
Germany
Tel. ++49-7071-29 70453 (0)
Fax ++49-7071-29 5148 (0)
Phone: ++49-176-20361469 (M)
            ++49-7071-1477169 (R)
Alternative e-mail: mi...@informatik.uni-tuebingen.de

        [[alternative HTML version deleted]]

______________________________________________
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