[英]Make a dataframe with artist, song and duration variables
I'm new with tidyverse in R.我是 R 中的 tidyverse 新手。
I have a dataframe radio
, from a radio channel, from a specfic date with variables: artist, song, duration.我有一个数据帧radio
,来自一个广播频道,来自一个带有变量的特定日期:艺术家、歌曲、持续时间。
My aim is to find which artist that has the most different songs playing on the choosen date.我的目标是找出在所选日期播放最多不同歌曲的艺术家。
radio %>% select(artist, song) %>% arrange...
and then I'm lost.然后我迷路了。 Please help if anyone is good at this.如果有人擅长这个,请帮助。
you can group_by
artist song and then compute the different songs:您可以group_by
艺术家歌曲,然后计算不同的歌曲:
radio %>%
select(artist, song) %>%
group_by(artist) %>%
summarise(n_song = n_distinct(song), .groups = "drop") %>%
arrange(-n_song)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.