Rows: 1,177
Columns: 105
$ song <chr> "Poor Little Fool", "Nel …
$ artist <chr> "Ricky Nelson", "Domenico…
$ date <dttm> 1958-08-04, 1958-08-18, …
$ weeks_at_number_one <dbl> 2, 5, 1, 6, 2, 1, 3, 4, 3…
$ non_consecutive <dbl> 0, 1, 0, 0, 1, 0, 0, 0, 0…
$ rating_1 <dbl> 4, 7, 5, 3, 7, 5, 8, 1, 9…
$ rating_2 <dbl> 5, 7, 6, 3, 8, 5, 8, 5, 9…
$ rating_3 <dbl> 3, 5, 6, 7, 9, 2, 8, 2, 8…
$ overall_rating <dbl> 4.000000, 6.333333, 5.666…
$ divisiveness <dbl> 1.3333333, 1.3333333, 0.6…
$ label <chr> "Imperial", "Decca", "Apt…
$ parent_label <chr> "Imperial", "Decca", "ABC…
$ cdr_genre <chr> "Pop;Rock", "Pop", "Rock"…
$ cdr_style <chr> "Acoustic Rock", "Vocal",…
$ discogs_genre <chr> "Rock", "Pop;Folk, World,…
$ discogs_style <chr> "Rock & Roll", "Vocal;Can…
$ artist_structure <dbl> 1, 1, 0, 1, 1, 0, 0, 0, 0…
$ featured_artists <chr> NA, NA, NA, NA, NA, NA, N…
$ multiple_lead_vocalists <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ group_named_after_non_lead_singer <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ talent_contestant <chr> NA, NA, NA, NA, NA, NA, N…
$ posthumous <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ artist_place_of_origin <chr> "United States", "Italy",…
$ front_person_age <dbl> 18.00000, 30.00000, 17.00…
$ artist_male <dbl> 1, 1, 1, 1, 1, 1, 2, 1, 2…
$ artist_white <dbl> 1, 1, 1, 0, 1, 1, 1, 0, 0…
$ artist_black <dbl> 0, 0, 0, 1, 0, 0, 0, 0, 1…
$ songwriters <chr> "Sharon Sheeley", "Franco…
$ songwriters_w_o_interpolation_sample_credits <chr> "Sharon Sheeley", "Franco…
$ songwriter_male <dbl> 0, 1, 1, 1, 1, 1, 1, 1, 1…
$ songwriter_white <dbl> 1, 1, 1, 1, 1, 1, 1, 0, 1…
$ artist_is_a_songwriter <dbl> 0, 1, 1, 0, 1, 0, 1, 1, 0…
$ artist_is_only_songwriter <dbl> 0, 0, 1, 0, 0, 0, 1, 1, 0…
$ producers <chr> "Jimmie Haskell;Ozzie Nel…
$ producer_male <dbl> 1, NA, NA, 1, 1, 1, 1, 1,…
$ producer_white <dbl> 1, NA, NA, 1, 1, 1, 1, 0,…
$ artist_is_a_producer <dbl> 1, NA, NA, 0, 0, 0, 1, 1,…
$ artist_is_only_producer <dbl> 0, NA, NA, 0, 0, 0, 1, 1,…
$ songwriter_is_a_producer <dbl> 0, 0, 0, 0, 0, 0, 1, 1, 0…
$ time_signature <chr> "4/4", "Free;6/8;4/4", "F…
$ keys <chr> "C", "Bb", "A", "Eb", "B"…
$ simplified_key <chr> "C", "Bb", "A", "Eb", "B"…
$ bpm <dbl> 155, 130, 73, 71, 127, 12…
$ energy <dbl> 33, 6, 40, 15, 43, 14, 20…
$ danceability <dbl> 54, 55, 41, 33, 44, 63, 3…
$ happiness <dbl> 80, 48, 70, 61, 36, 52, 3…
$ loudness_d_b <dbl> -12, -17, -13, -18, -10, …
$ acousticness <dbl> 67, 98, 87, 4, 86, 83, 89…
$ vocally_based <dbl> 0, 0, 1, 1, 1, 0, 1, 0, 1…
$ bass_based <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ guitar_based <dbl> 1, 0, 1, 0, 0, 1, 1, 1, 0…
$ piano_keyboard_based <dbl> 0, 1, 0, 1, 1, 0, 0, 0, 0…
$ orchestral_strings <dbl> 0, 1, 0, 1, 0, 0, 0, 0, 1…
$ horns_winds <dbl> 0, 0, 1, 0, 0, 0, 0, 1, 0…
$ accordion <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ banjo <dbl> 0, 0, 0, 0, 0, 1, 0, 0, 0…
$ bongos <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ clarinet <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ cowbell <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ falsetto_vocal <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ flute_piccolo <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ handclaps_snaps <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ harmonica <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ human_whistling <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ kazoo <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ mandolin <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ pedal_lap_steel <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ ocarina <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ saxophone <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ sitar <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ trumpet <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ ukulele <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ violin <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ sound_effects <chr> NA, NA, NA, NA, NA, NA, N…
$ song_structure <chr> "A2", "E1", "D3", "D1", "…
$ rap_verse_in_a_non_rap_song <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ length_sec <dbl> 154, 219, 163, 156, 134, …
$ instrumental <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ instrumental_length_sec <dbl> 12, 11, 0, 0, 0, 7, 8, 28…
$ intro_length_sec <dbl> 12, 40, 10, 3, 24, 31, 8,…
$ vocal_introduction <dbl> 0, 1, 1, 0, 1, 1, 0, 0, 0…
$ free_time_vocal_introduction <dbl> 0, 1, 1, 0, 1, 0, 0, 0, 0…
$ fade_out <dbl> 0, 0, 0, 0, 0, 0, 1, 1, 0…
$ live <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ cover <dbl> 0, 0, 0, 0, 0, 1, 0, 0, 1…
$ sample <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ interpolation <dbl> 0, 0, 1, 1, 0, 0, 0, 0, 0…
$ inspired_by_a_different_song <dbl> 0, 0, 1, 1, 0, 1, 0, 0, 1…
$ lyrics <chr> "I used to play around wi…
$ lyrical_topic <chr> "Lost Love", "Flying;Drea…
$ lyrical_narrative <dbl> 0, 0, 0, 0, 0, 1, 0, 0, 0…
$ spoken_word <dbl> 0, 0, 0, 0, 0, 1, 0, 0, 0…
$ explicit <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ foreign_language <dbl> 0, 1, 0, 0, 0, 0, 0, 0, 0…
$ written_for_a_play <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 1…
$ featured_in_a_then_contemporary_play <chr> NA, NA, NA, NA, NA, NA, N…
$ written_for_a_film <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ featured_in_a_then_contemporary_film <chr> NA, NA, NA, NA, NA, NA, N…
$ written_for_a_t_v_show <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ featured_in_a_then_contemporary_t_v_show <chr> NA, NA, NA, NA, NA, NA, N…
$ associated_with_dance <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ topped_the_charts_by_multiple_artist <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ double_a_side <chr> NA, NA, NA, NA, NA, NA, N…
$ eurovision_entry <dbl> 0, 1, 0, 0, 0, 0, 0, 0, 0…
$ u_s_artwork <chr> "Cannot Locate", "Cannot …
Check-in 1: Exploratory Analysis
You will explore the data set you chose: look at it, summarize it, graph it, and notice things. Then you will use what you noticed to plan which statistical techniques could answer the questions that came up.
You are not running hypothesis tests or building models yet. The goal is to show that you understand your data well enough to choose sensible next steps.
- Write your responses inside the answer boxes. Delete the line “Please write up your answer here.” and type your own.
- The code is written to work on any data frame, so most of the descriptive work runs automatically. Read the output and interpret it in your own words.
- Chunks marked EDIT need you to enter your own variable names.
1 About the data
Data set name and source (who collected or published it):
Chris Dala Riva is the creator of Billboard Hot 100 Number Ones Database.
When were the data collected?
The data was collected between August 4,1958 and January 11,2025
What does one row represent? (a person, a school, a state, a day, …)
One of the rows represent the amount of weeks the song was at Number 1.
What time period does the data represent? (present day, a single year, a range of times, unknown…)
The data represents the appox. 66 years time period.
1.1 Is this a sample?
Not every data set is a sample. Whether you can generalize beyond your data depends on where it came from, so decide this now and keep it in mind for the rest of the project.
What group (population) are the data meant to describe?
The group that is meant to be described is all the songs that reached number one on the Billboard Hot 100 during this time period.
Does the data set contain every case in that group, or only some of them? If only some, how were they chosen (random, convenience, volunteer, administrative records, unknown)?
The dataset includes all songs that reached number one during this time period.
Was this an experiment (treatments were assigned) or an observational study?
This was an observational study there was no experiments. The songs already existed.
| Your data are… | What you can reasonably do later |
|---|---|
| A random sample from a clear population | Describe the sample and use inference (confidence intervals, tests) to say something about the population |
| A convenience or volunteer sample | Describe the sample; any generalization needs strong caveats about who is and is not represented |
| A census / entire population (all 50 states, every course this term) | Describe and compare. There is no sampling variability to estimate, so classic tests need careful justification |
| Time-ordered records (daily, yearly) | Look at trends and patterns over time; observations are not independent, so standard tests can mislead |
| A randomized experiment | Differences between groups can support causal conclusions |
| Observational data (any kind of sample) | Associations only, not cause and effect |
My best classification of these data (random sample, convenience sample, census or full population, time-ordered, experiment, other, not sure) and my reasoning:
This dataset is full of of population and cenus because it includes all number one songs during the time period and allows us to see how music has changed over the years.
1.2 Load the data
This file currently has examples from the mpg dataframe. Read in your data below. As you work on this check-in assignment,copy the example code, paste a new copy below it and adjust the copy to your setting (keeping both). When you are done and the file renders properly, delete everything (including this message) related to dat or mpg.
1.3 First look
| Variable | Number missing | % missing |
|---|---|---|
| featured_in_a_then_contemporary_play | 1175 | 99.8 |
| talent_contestant | 1167 | 99.2 |
| double_a_side | 1165 | 99.0 |
| featured_in_a_then_contemporary_t_v_show | 1152 | 97.9 |
| sound_effects | 1113 | 94.6 |
| featured_in_a_then_contemporary_film | 1073 | 91.2 |
| featured_artists | 988 | 83.9 |
| cdr_genre | 88 | 7.5 |
| cdr_style | 88 | 7.5 |
| artist_black | 63 | 5.4 |
| lyrics | 35 | 3.0 |
| lyrical_topic | 26 | 2.2 |
| discogs_style | 25 | 2.1 |
| front_person_age | 22 | 1.9 |
| discogs_genre | 16 | 1.4 |
| u_s_artwork | 13 | 1.1 |
| producer_male | 4 | 0.3 |
| producer_white | 4 | 0.3 |
| artist_is_a_producer | 4 | 0.3 |
| artist_is_only_producer | 4 | 0.3 |
| songwriter_male | 2 | 0.2 |
| songwriter_white | 2 | 0.2 |
| bpm | 2 | 0.2 |
| energy | 2 | 0.2 |
| danceability | 2 | 0.2 |
| happiness | 2 | 0.2 |
| loudness_d_b | 2 | 0.2 |
| acousticness | 2 | 0.2 |
| label | 1 | 0.1 |
| parent_label | 1 | 0.1 |
| songwriters_w_o_interpolation_sample_credits | 1 | 0.1 |
Missing values: which variables have them, roughly how many, and is there any pattern?
There’s 3 variables the songs, artist and the date they were published.
2 Numerical variables
2.1 Weeks at Number One & BPM
Explore at least 2 numerical variables by looking at the summary statistics and histograms for each. You are provided code chunks for the first of these but you should copy the code chunks and answer block for the next variable. You are encouraged to look at more than 2 variables here.
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.000 1.000 2.000 2.938 4.000 19.000
[1] 2.643577
[1] 3
[1] 2 5 1 6 2 1
[1] "song"
[2] "artist"
[3] "date"
[4] "weeks_at_number_one"
[5] "non_consecutive"
[6] "rating_1"
[7] "rating_2"
[8] "rating_3"
[9] "overall_rating"
[10] "divisiveness"
[11] "label"
[12] "parent_label"
[13] "cdr_genre"
[14] "cdr_style"
[15] "discogs_genre"
[16] "discogs_style"
[17] "artist_structure"
[18] "featured_artists"
[19] "multiple_lead_vocalists"
[20] "group_named_after_non_lead_singer"
[21] "talent_contestant"
[22] "posthumous"
[23] "artist_place_of_origin"
[24] "front_person_age"
[25] "artist_male"
[26] "artist_white"
[27] "artist_black"
[28] "songwriters"
[29] "songwriters_w_o_interpolation_sample_credits"
[30] "songwriter_male"
[31] "songwriter_white"
[32] "artist_is_a_songwriter"
[33] "artist_is_only_songwriter"
[34] "producers"
[35] "producer_male"
[36] "producer_white"
[37] "artist_is_a_producer"
[38] "artist_is_only_producer"
[39] "songwriter_is_a_producer"
[40] "time_signature"
[41] "keys"
[42] "simplified_key"
[43] "bpm"
[44] "energy"
[45] "danceability"
[46] "happiness"
[47] "loudness_d_b"
[48] "acousticness"
[49] "vocally_based"
[50] "bass_based"
[51] "guitar_based"
[52] "piano_keyboard_based"
[53] "orchestral_strings"
[54] "horns_winds"
[55] "accordion"
[56] "banjo"
[57] "bongos"
[58] "clarinet"
[59] "cowbell"
[60] "falsetto_vocal"
[61] "flute_piccolo"
[62] "handclaps_snaps"
[63] "harmonica"
[64] "human_whistling"
[65] "kazoo"
[66] "mandolin"
[67] "pedal_lap_steel"
[68] "ocarina"
[69] "saxophone"
[70] "sitar"
[71] "trumpet"
[72] "ukulele"
[73] "violin"
[74] "sound_effects"
[75] "song_structure"
[76] "rap_verse_in_a_non_rap_song"
[77] "length_sec"
[78] "instrumental"
[79] "instrumental_length_sec"
[80] "intro_length_sec"
[81] "vocal_introduction"
[82] "free_time_vocal_introduction"
[83] "fade_out"
[84] "live"
[85] "cover"
[86] "sample"
[87] "interpolation"
[88] "inspired_by_a_different_song"
[89] "lyrics"
[90] "lyrical_topic"
[91] "lyrical_narrative"
[92] "spoken_word"
[93] "explicit"
[94] "foreign_language"
[95] "written_for_a_play"
[96] "featured_in_a_then_contemporary_play"
[97] "written_for_a_film"
[98] "featured_in_a_then_contemporary_film"
[99] "written_for_a_t_v_show"
[100] "featured_in_a_then_contemporary_t_v_show"
[101] "associated_with_dance"
[102] "topped_the_charts_by_multiple_artist"
[103] "double_a_side"
[104] "eurovision_entry"
[105] "u_s_artwork"
[1] 2 5 1 6 2 1
Describe this distribution. Comment on shape (symmetric, skewed, multiple peaks), center, spread, and outliers. Would you summarize it with the mean and SD or the median and IQR, and why? Write a sentence summarizing what this tells you about the topic of your dataframe.
The distribution is right-skewed because most songs stayed at number one for a few weeks, but some stayed longer. The center is around 2 weeks. Most songs stayed between 1 & 4 weeks.I would use the median and IQR because the data is skewed and has outliers.
2.2 Variable 2 (copy and paste the analysis from Variable 1 and alter it to analyze another variable)
Length Class Mode
0 NULL NULL
[1] NA
[1] NA
3 Categorical variables
3.1 CDR Genre & Explicit
Explore at least 2 categorical variables by making a contingency table and a bar chart for each. You are provided code chunks for the first of these, but you should copy the code chunks and answer block for the next variable. You are encouraged to look at more than 2 variables here.
character(0)
Describe this variable. Which categories are most common and which are rare? Are the categories roughly balanced or does one dominate? Are there so many categories that you would want to combine or delete some of them? Write a sentence summarizing what this tells you about the topic of your dataframe.
Pop is the most common genre, followed by Rock and Funk/Soul. Reggae and combined genres are the least common. The categories aren’t balanced because Pop has many more songs than the others.
3.2 Categorical Variable 2 (copy and paste the analysis from Variable 1 and alter it to analyze another variable)
character(0)
4 Comparing groups on numerical variables
With a large data set, some of the most informative comparisons come from splitting the cases into groups and asking whether numerical variables behave differently in each group. In this section you will compare summary statistics and histograms across groups, and you can filter the data to focus on the cases you care about. For example, we might want to compare SUVs and Pickup trucks so we would want to filter them like we did with the giraffes from different islands.
4.1 Choose your groups and filter
Which groups do you want to compare and why? What variable do you want to compare for these groups?
I want to compare Pop and Rock songs because they’re two of the most common music genres in my dataset. I want to compare BPM to see if Pop songs tend to have a faster or slower tempo than Rock songs.
Use the code chunk below to create dataframes for each group by filtering.
How many cases (units of observation) are in each group, and are any groups too small to say much?
Pop - 342 units of Observation Rock - 271 units of Observation
4.2 Summary statistics by group
Calculate summary statistics for a numerical variable for each group.
# A tibble: 18 × 3
Genre Statistic BPM
<chr> <chr> <dbl>
1 Pop Count 342
2 Pop Mean 115
3 Pop Median 116
4 Pop Standard_Deviation 24.9
5 Pop Minimum 16
6 Pop Maximum 176
7 Pop Q1 98
8 Pop Q3 131.
9 Pop IQR 32.8
10 Rock Count 270
11 Rock Mean 119.
12 Rock Median 121
13 Rock Standard_Deviation 24.2
14 Rock Minimum 65
15 Rock Maximum 175
16 Rock Q1 102.
17 Rock Q3 135.
18 Rock IQR 32.5
# A tibble: 2 × 6
Genre Count Mean SD Q1 Q3
<chr> <int> <dbl> <dbl> <dbl> <dbl>
1 Pop 342 115 24.9 98 131.
2 Rock 270 119. 24.2 102. 135.
For each variable, how do the groups compare in center (mean, median) and spread (SD, IQR)? Which variables show the biggest differences between groups? Is the mean close to the median in each group (a hint about skew)?
Rock songs are slightly faster than Pop songs, with an average BPM of 119 compared to 115. Both genres have a similar spread in BPM.
4.3 Distributions by group
Create histograms for each group below. You may want them in a single graph or choose two different graphs.
Now make a boxplot for each group. Examples can be found at the R Graph Gallery.
Compare the shapes of the distributions across groups. Are they symmetric or skewed? Do they have similar spread? Do they overlap a lot or hardly at all? Are there outliers or a group with two peaks?
Pop and Rock songs have similar distributions. Both are mostly mound-shaped with one main peak. Rock songs have a slightly higher BPM than Pop songs. The spreads are very similar, and the two groups overlap a lot. Pop has one low outlier, while Rock doesn’t have any obvious outliers.
Which differences between groups look big compared to the variation within groups, and which look small? What might explain the differences you see?
Rock songs are slightly faster than Pop songs, but the difference is very small. Their averages are close, with Pop at 115 BPM and Rock at about 119 BPM. Both groups have similar variation. This could be because both genres have songs with a wide range of tempos.
5 What did you notice?
List at least four things that caught your attention (patterns, surprises, possible errors, differences between groups, relationships). Each one should point to a plot or summary above.
Pop is the most common music genre in my dataset.
Rock songs have a slightly higher average BPM than Pop songs.
Pop and Rock songs have very similar spreads in BPM.
There is one low BPM outlier in the Pop histogram and boxplot.
6 Observations and Questions
This exploration of the data should set you up to ask or answer questions based on what you observed. Formalize two questions below.
6.1 Question A
What I noticed Histogram:
Rock songs have a slightly higher average BPM than Pop songs based on the summary statistics.
Question in plain English
Do Rock songs tend to have a faster tempo than Pop songs?
Variables and their types to address this question (which is the response? which is explanatory?):
Response variable: BPM (numerical). Explanatory variable: Music genre (categorical).
6.2 Question B
What I noticed Box Plot:
The box plot shows that Rock songs are slightly faster than Pop songs. Both have a similar spread, but Pop has one low outlier.
Question in plain English:
Do Pop and Rock songs have different amounts of variation in their BPM?
Variables and their types:
BPM: Numerical Music Genre: Categorical
6.3 A question the data cannot answer
Write one interesting question you wish you could ask, but this data set cannot answer well. What is missing (variables, a random sample, a comparison group, more time points)?
I would like to know whether songs that become number one are more popular because of social media. The dataset doesn’t include information about social media popularity or promotion.
7 Reflection and next steps
What was the most surprising thing you found in the data?
I was surprised that Rock songs were slightly faster than Pop songs.
Which of your questions would you most want to pursue, and why?
I would want to explore whether Rock songs are faster than Pop songs because I found it interesting that their average BPM was different.
What is the biggest limitation of this data set for drawing conclusions?
The dataset only includes Billboard number-one songs, so it may not represent all Pop and Rock songs.
What are you still unsure about? (questions for your instructor)
N/A