Today has been quite challenging so I can't think of any new ideas anymore so the solution to this question may be quite obvious to you. I have a very simple data frame like bellow:
structure(list(user_id = c(101, 102, 102, 103, 103, 106, 107,
111), phone_number = c(4030201, 4030201, 4030202, 4030202, 4030203,
4030204, 4030205, 4030203), id = 1:8), class = "data.frame", row.names = c(NA,
-8L))
and also a list:
list(c(1, 2, 3, 4, 5, 8), 6, 7)
I want to group each value in id column of my data frame based on the category they fall into of elements of the list preferably with purrr package functions. So the desired output is something like this:
grp <- c(1, 1, 1, 1, 1, 2, 3, 1)
Thank you very much in advance and learning from/ beside you guys has been a great honor of my life.
Sincerely Yours
Anoushiravan