1

I have this data frame

user_id Value webpage
       1   100  google
       1    50  bing

I am trying to group by user id and get the mean of "Value" and the value of the webpage where "Value" is the min, in this case "bing"

I have this code where I can get the mean

data <- data %>% group_by(user_id) %>% 
  summarise(mean=mean(Value))

and I get this result

user_id  mean
      1    75

how can I get this result

user_id  mean  webpage
      1    75     bing

thanks for the help

Juan Lozano
  • 635
  • 1
  • 6
  • 17

0 Answers0