Dear group,
I have the following data frame df
Measure_id i j id value1 1 5 1 1 2.02 1 5 2 1 2.03
1 5 1 2 1.54 1 5 2 2 1.55 1 5 1 3 0.06
1 5 2 3 0.07 1 5 1 4 0.08 1 5 2 4 1.09
1 5 1 5 1.010 1 5 2 5 2.0.. ... . . .. ...I want
to add a probability column, the prob column depends on id grouped by for each
ithe rank will be current (value / max value ) for the same id for specific i,
it would be
Measure_id i j id value prob1 1 5 1 1 2.0 2/2 2
1 5 2 1 2.0 2/2 3 1 5 1 2 1.5 1.5/1.5
4 1 5 2 2 1.5 1.5/1.5 5 1 5 1 3 0.0
06 1 5 2 3 0.0 07 1 5 1 4 0.0 0/1
8 1 5 2 4 1.0 1/1 9 1 5 1 5 1.0
1/210 1 5 2 5 2.0 2/3.. ... . . .. ...
then I want to add a rank coulmn that rank regarding probability, if the
probability equal they took the same rank for thesame id belongs to the same i,
otherwize lower probability took higher rank for examole if we have three
values for i=7 and for the three values the id is 1 and the probability is (
.2,.4,.5) the rank should be 3,2,1
replying highly appreciatedRagia
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
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.