0

Below dataset is details of customers with same ID against there income.

ID  Customer    Income
 1   Vijay       10
 2   Ananth      13
 1   Ram         11
 1   Gopal       10
 2   Sid         15
 3   Rak         20
 3   Antony      12

I need an output that groups ID's and Customer only with minimum salary. For example for ID 1, minimum salary is 10 and the person is Gopal. So the result should be

ID      Customer
 1      Gopal, Vijay
 2      Ananth
 3      Antony
R learn
  • 33
  • 4
  • 1
    Multiple ways to do this, easiest would be `library(dplyr); df %>% group_by(ID) %>% slice(which.min(Income)) ` – Ronak Shah Sep 28 '18 at 03:18
  • Hi, Thanks for this. But there is a challenge. What if there are 2 Customers with min Income. See my edited dataset. – R learn Oct 02 '18 at 13:42

0 Answers0