I have this data.
datetime user_id song_id
1 2019-03-26 6 31
2 2019-03-26 4 30
3 2019-03-26 3 31
4 2019-03-26 9 34
5 2019-03-26 10 21
6 2019-03-26 8 38
7 2019-03-26 8 33
8 2019-03-26 8 28
9 2019-03-26 6 30
I'd like to make a third column, so the data looks like this
datetime user_id song_id usersong_id
1 2019-03-26 6 31 631
2 2019-03-26 4 30 430
3 2019-03-26 3 31 331
4 2019-03-26 9 34 934
5 2019-03-26 10 21 1021
6 2019-03-26 8 38 838
7 2019-03-26 8 33 833
8 2019-03-26 8 28 828
9 2019-03-26 6 30 630
I tried this code.
df %>%
group_by(user_id, song_id) %>%
summarize(count = n()) %>%
mutate(usersong_id = c(user_id, song_id))
But, it gave me this error:
Error: Column
usersong_id
must be length 1 (the group size), not 2