简体   繁体   English

使用艺术家、歌曲和持续时间变量制作数据框

[英]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.

相关问题 如何使新变量循环遍历数据帧中的两个变量 - how to make new variables looping through two variables in dataframe 通过最佳字符串匹配对数据帧中的字符串变量进行分组以生成子集 - Grouping string variables from a dataframe by best string match to make subsets 如何使用 R 中的单个变量制作 dataframe 中所有变量的 plot - How to make a plot of all variables in dataframe with a single variable in R 如何为数据框中的所有分类变量制作频率表? - How to make frequency table for all categorical variables in a dataframe? 如何让我的 function 访问这个 dataframe 中的变量? - How can I make my function access variables in this dataframe? 如何从数据框创建持续时间向量? - How to create a duration vector from a dataframe? 在分组的r数据帧中查找逐组持续时间 - Finding group wise duration in an grouped r dataframe 如何创建具有多个分类变量和交互作用的数据框,并按ID分组? - How do I make my create a dataframe with multiple categorical variables and interaction effects, grouped by ID? 从数据框中创建一个列表:A 列是变量,B 列与 C 列中的值相关联 - Make a list from a dataframe: column A are variables and column B are associated with values in column C 数据框中变量的回归 - Regression of variables in a dataframe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM