library(tidyverse)
library(janitor)Analysis
Billboard Hot 100 chart data analysis
Now that we have the Billboard Hot 100 charts data in our project it’s time to find the answers to the following questions:
- Which performer had the most appearances on the Hot 100 chart at any position?
- Which song (title & performer) has been on the charts the most?
- Which song (title & performer) was No. 1 for the most number of weeks?
- Which performer had the most songs reach No. 1?
- Which performer had the most songs reach No. 1 in the most recent five years?
- Which performer has had the most Top 10 hits overall?
Setup
Importing the clean data
# Importing the clean data
hot100 <- read_rds("data-processed/01-hot100.rds")
hot100 |> glimpse()Rows: 345,000
Columns: 7
$ chart_date <date> 1958-08-04, 1958-08-04, 1958-08-04, 1958-08-04, 1958-08…
$ current_rank <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1…
$ title <chr> "Poor Little Fool", "Patricia", "Splish Splash", "Hard H…
$ performer <chr> "Ricky Nelson", "Perez Prado And His Orchestra", "Bobby …
$ previous_rank <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
$ peak_rank <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1…
$ wks_on_chart <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
Summarizing appearances
Now I am looking for most appearances.
hot100 |>
group_by(performer) |>
summarize(appearances = n()) |>
arrange(desc(appearances)) |>
head(10)Data Takeaway: Taylor Swift has more solo appearances on the Billboard Hot 100 than any other artist in history with 1,589 appearances through Sept. 21, 2024. This does not include collaborations with other artists.
Song appearances
Which song (title & performer) has been on the charts the most?
Here we will consider both title and performer together because different artists can perform songs of the same name.
hot100 |>
group_by(performer, title) |>
summarize(appearances = n()) |>
arrange(appearances |> desc()) |>
filter(appearances >= 65)`summarise()` has grouped output by 'performer'. You can override using the
`.groups` argument.
Data Takeaway: The song “Heat Waves” by Glass Animals has appeared 91 times on the Billboard Hot 100 chart, more than any other song through Sept. 21, 2024. “Blinding Lights” by The Weeknd is second with 90 appearances.
Song the longest at No. 1
Which song (title & performer) was No. 1 for the most number of weeks?
In this case, we only want titles that have a current_rank of 1. This means we will filter before any summarizing. In the end we want to count the number of rows with the same performer and title combinations. Since we are counting rows, we need use n() as our summarize function, which counts the number or rows in each group.
hot100 |>
filter(current_rank == 1) |>
group_by(performer, title) |>
summarize(appearances = n()) |>
arrange(appearances |> desc()) |>
filter(appearances >= 15)`summarise()` has grouped output by 'performer'. You can override using the
`.groups` argument.
Data Takeaway: The song “Old Town Road” by Lil Nas X Featuring Billy Ray Cyrus has spent more time at the top of the Billboard Hot 100 than any other song in history at 19 weeks.
Performer with most No. 1 singles
Which performer had the most titles reach No. 1?
We need to consider only No. 1 songs (so, filter!). But a song can be No. 1 for more than one week and we don’t want to count them more than once. We need each No. 1 title/performer combination only once. Another way to think of this is we need distinct combinations of title/performer.
hot100 |>
filter(current_rank == 1) |>
distinct(title, performer) |>
group_by(performer) |>
summarize(no1_hits = n()) |>
arrange(no1_hits |> desc()) |>
filter(no1_hits >= 10)Data Takeaway: The Beatles have the most No. 1 hits on the Billboard Hot 100 charts with 19, but they also have a 20th top song – “Get Back” – that is a collaboration with Billy Preston. Most other artists with double-digit top hits aren’t making new music, with the exception of Mariah Carey and Taylor Swift.
Most No. 1 hits in last five years
Which performer had the most songs reach No. 1 in the most recent five years?
Here, in addition to filtering for No. 1 songs, we also want to filter for charts since 2019.
hot100 |>
filter(
current_rank == 1,
chart_date >= "2019-01-01"
) |>
distinct(title, performer) |>
group_by(performer) |>
summarize(top_hits = n()) |>
arrange(top_hits |> desc()) |>
filter(top_hits > 1)Data Takeaway: Taylor Swift not only has the most appearances of all time in the Hot 100, she also has the most No. 1 hits in the past five years with six.
Multiple truths
Here, we will filter data for when two or more things are true. We can write two equations and combine with &. Only rows where both sides prove true are returned.
This shows when Butter by BTS was No. 1, but not any other position.
hot100 |>
filter(title == "Butter" & current_rank == 1) |>
select(chart_date:performer)Either is true
This is an “or” filter. You write two equations with a | between them.
This shows songs by Jimin OR Jung Kook.
hot100 |>
filter(performer == "Jimin" | performer == "Jung Kook") |>
select(chart_date:performer)Mixing criteria
If you have multiple criteria, you separate them with a comma.
This gives us rows with either Nicki Minaj or Cardi B, but only those that reached No. 1 (and no collaborations.)
hot100 |>
filter(
(performer == "Nicki Minaj" | performer == "Cardi B"),
current_rank == 1
) |>
distinct(current_rank, title, performer)Search within a string
To search for text within the data, you can use str_detect() to look for specific characters within a value to filter rows. str_detect() needs two arguments: 1) What column to search in, and 2) what to search for “in quotes”. I also use distinct() here to show only unique title/performer combinations.
This shows songs where “Post Malone” was among the performers.
hot100 |>
filter(str_detect(performer, "Post Malone")) |>
distinct(performer, title)Most Top 10 hits
Which performer had the most Top 10 hits overall?
Here I will adjust the filter to find songs within position 1 through 10.
hot100 |>
filter(current_rank <= 10) |>
distinct(title, performer) |>
group_by(performer) |>
summarize(most_hits = n()) |>
arrange(desc(most_hits)) |>
filter(most_hits >= 21)Data Takeaway: Taylor Swift has also had the most Top 10 hits overall with 52. Madonna came in second place with 36 and The Beatles placed third with 34.
Something I want to know
Which BTS members have had solo songs without collaborations appear on the Billboard Hot 100, and who has had the most appearances among them?
hot100 |>
filter(performer == "Jimin" | performer == "Jung Kook" | performer == "RM" | performer == "JIN" | performer == "Suga" | performer == "j-hope" | performer == "V" | performer == "Agust D") |>
group_by(performer) |>
summarize(appearances = n()) |>
arrange(desc(appearances))Explanation:
- I used the filter() function to specify that I only want to analyze the appearances of each of the names of BTS members.
- I used the “or” filter by inputting | so that the filter will look for each of the members’ names.
- I used the group_by(performer) to put data into groups by performer.
- I used summarize(appearances = n()) to build a summary table about the appearances.
- I used arrange(desc(appearances)) to arrange the data by appearances in descending order so that the performer with the highest number of appearances is at the top.
Data Takeaway: Jimin, V, Jung Kook, j-hope, JIN and Suga under the alias Agust D, have each had solo songs with no collaborations appear on the Billboard Hot 100. Jung Kook has made the most appearances with 21 and RM has not had a solo song with no collaborations appear on the chart.
Christmas songs
As the 2024 holiday season approaches, my sister and I were wondering if Underneath the Tree by Kelly Clarkson has ever reached number 1 on the Billboard Hot 100 chart. We noticed the song is played often on the radio and were curious to see if it has ever surpassed All I Want For Christmas Is You by Mariah Carey during the holidays.
hot100 |>
filter(title == "All I Want For Christmas Is You" & current_rank == 1) |>
select(chart_date:performer)hot100 |>
filter(title == "Underneath The Tree" & current_rank == 1) |>
select(chart_date:performer)hot100 |>
filter(
(title == "All I Want For Christmas Is You" | title == "Underneath The Tree"),
current_rank == 1) |>
select(chart_date:performer)Data takeaway: Underneath the Tree by Kelly Clarkson has not reached number 1 on the Billboard Hot 100 chart or surpassed All I Want For Christmas Is You by Mariah Carey during the holidays.