[R] groups Rank
Ragia Ibrahim
ragia11 at hotmail.com
Sat Sep 5 16:44:13 CEST 2015
thanks for replying, I attached the data frame for source "i" I want to sum the values and get the max value then add a new column called rank . That new column cell value for each source i and for specific id would be (value/max value) * count of rows that have the same criteria "same i and same id"
many thanksRagia
> Date: Fri, 4 Sep 2015 10:19:35 -0400
> Subject: Re: [R] groups Rank
> From: sarah.goslee at gmail.com
> To: ragia11 at hotmail.com
> CC: r-help at r-project.org
>
> Hi Ragia,
>
> I can't make out your data or desired result, but it sounds like
> aggregate() might get you started. If you need more help, please
> repost your data using dput() and do NOT post in HTML so that we can
> see what your desired result looks like.
>
> Sarah
>
> On Fri, Sep 4, 2015 at 10:12 AM, Ragia Ibrahim <ragia11 at hotmail.com> wrote:
> > Dear Group,kinldy, I have the following data frame df
> > id value1 1 4 2 1 4 3 1 6 4 1 6 5 2 1.5 6 2 2.5 7 2 2.5 8 2 2.5
> >
> > add rank column regarding id coulmn where rank for the highest value would be 1, others rank would be the (value/ value of heighest)/ number of rows that took the same value
> > thus the data frame should be
> > id value Rank1 1 4 0.332 1 4 0.333 1 6 0.54 1 6 0.55 2 1.5 0.6 6 2 2.5 0.337 2 2.5 0.338 2 2.5 0.33
> >
> > how to reach this resultthanks in advanceRagia
> > [[alternative HTML version deleted]]
> >
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: measures.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150905/18b6e044/attachment.txt>
More information about the R-help
mailing list