Does anyone have a function that will calculate the 95th percentile (or any percentile for that matter) on grouped data? I see that there are numerous methods to calculate the percentiles on the entire table but I haven't found any that work correctly on grouped data. - Thanks
<tbody>
</tbody>grouping on location, type and ana the return would look as follows:
<tbody>
</tbody>
table1 | ||||
Location | Type | sampname | ana | result |
Loc1 | Wet | Sample1 | ana1 | 12 |
Loc1 | Wet | Sample1 | ana2 | 3 |
Loc1 | Wet | Sample1 | ana3 | 15 |
Loc1 | Wet | sample2 | ana1 | 44 |
Loc1 | Wet | sample2 | ana2 | 23 |
Loc1 | Wet | sample2 | ana3 | 25 |
Loc1 | Wet | sample2 | ana4 | 12 |
Loc1 | Dry | sample3 | ana1 | 44 |
Loc1 | Dry | sample3 | ana2 | 55 |
Loc1 | Dry | sample3 | ana3 | 76 |
Loc1 | Dry | sample4 | ana1 | 8 |
Loc1 | Dry | sample4 | ana2 | 57 |
Loc1 | Dry | sample4 | ana3 | 46 |
Loc1 | Dry | sample4 | ana4 | 99 |
Loc2 | Wet | sample5 | ana1 | 124 |
Loc2 | Wet | sample5 | ana2 | 66 |
Loc2 | Wet | sample5 | ana3 | 6 |
Loc2 | Wet | sample6 | ana1 | 789 |
Loc2 | Wet | sample6 | ana2 | 88 |
Loc2 | Wet | sample6 | ana3 | 767 |
Loc2 | Wet | sample6 | ana4 | 565 |
<tbody>
</tbody>
Location | Type | ana | 95th |
Loc1 | Wet | ana1 | 42.4 |
Loc1 | Wet | ana2 | 22 |
Loc1 | Wet | ana3 | 24.5 |
Loc1 | Wet | ana4 | 12 |
Loc1 | Dry | ana1 | 42.2 |
Loc1 | Dry | ana2 | 56.9 |
Loc1 | Dry | ana3 | 74.5 |
Loc1 | Dry | ana4 | 99 |
Loc2 | Wet | ana1 | 755.75 |
Loc2 | Wet | ana2 | 86.9 |
Loc2 | Wet | ana3 | 728.95 |
Loc2 | Wet | ana4 | 565 |
<tbody>
</tbody>
Last edited: