I would like to subset values from one continuous column based on the conditions of two categorical columns.
> df.example <- data.frame(V1 = c("A", "A", "A", "B", "B", "B", "A", "A", "B", "B"),
+ V2 = c("B", "A", "B", "A", "B", "A", "B", "A", "B", "A"),
+ V3 = c("5", "3", "1", "7", "11", "2", "2", "11", "1", "3"))
> df.example
V1 V2 V3
1 A B 5
2 A A 3
3 A B 1
4 B A 7
5 B B 11
6 B A 2
7 A B 2
8 A A 11
9 B B 1
10 B A 3
From df.example I would like to retrieve those rows where V3 is max for each unique combination of V1=V2; here
5 B B 11
8 A A 11
and the minimum for each unique combination when V1=/V2; here
3 A B 1
10 B A 3
This is simplified of course, there are 100's of categories in V1 and V2 in my data frames.