Fx claim_x
1 0.00 0
2 0.05 0
3 0.06 0
4 0.10 0
5 0.30 0
6 0.35 100
7 0.50 350
8 0.60 350
9 0.70 850
10 0.79 2350
11 0.90 4850
12 1.00 4850
The above is the data frame. If I want to group_by claim_x and select the minimum of Fx, I do this:
min <- df %>% dplyr::group_by(claim_x) %>% dplyr::summarise(Fx=min(Fx))
and if I want the max, I do this:
max <- points %>% dplyr::group_by(claim_x) %>% dplyr::summarise(Fx=max(Fx))
The question is, how do I select both the min and max in the same column? So the output should have the same structure as the input, i.e. a data frame with Fx and claim_x columns only.
Output should be:
# A tibble: 9 x 2
claim_x Fx
<dbl> <dbl>
1 0 0
2 0 0.3
3 100 0.35
4 350 0.5
5 350 0.6
6 850 0.7
7 2350 0.79
8 4850 0.9
9 4850 1