.Rmd
file. Choose the HTML file type.Insert a code chunk to read the dataset
spotify_weekly_chart
(downloaded from @Kaggle)
from the Dataset
folder. Then:
Give a name to this code chunk.
Add plain text description above the code chunk:
“The dataset contains data regarding the artist and the songs on the
Spotify global weekly chart.
For each song, the artist name, the number of stream and the peak in the
chart are reported.”
Add the following unordered list describing the variables:
kaggle_spotify_weekly_chart <- read.csv("Exercises/Datasets/spotify_weekly_chart.csv")
head(kaggle_spotify_weekly_chart)
## Pos P. Artist Title Wks Pk X.x.. Streams Streams.
## 1 1 = SZA Kill Bill 5 1 (x2) 47288509 5814143
## 2 2 +3 Metro Boomin Creepin' 6 2 (x1) 30753658 2661426
## 3 3 -1 Sam Smith Unholy 16 1 (x7) 30733283 -2398892
## 4 4 -1 Harry Styles As It Was 41 1 (x11) 28522200 -2475884
## 5 5 -1 David Guetta I'm Good (Blue) 20 2 (x4) 27260313 -3443943
## 6 6 = Manuel Turizo La Bachata 28 4 25879286 -1477809
## Total
## 1 208044297
## 2 184223144
## 3 673533882
## 4 1747957886
## 5 568898155
## 6 693820743
Data transformation
section
to:Evaluate the dimensions of the dataframe
Create a vector containing the streams of the first top 5 songs in the chart, naming each element of the vector with the corresponding artist name.
Create a vector containing the streams of the first top 5 songs in the chart, naming each element of the vector with the corresponding song title.
dim(kaggle_spotify_weekly_chart)
## [1] 200 10
artists <- kaggle_spotify_weekly_chart[1:5, 'Streams']
names(artists) <- kaggle_spotify_weekly_chart[1:5,'Artist']
songs <- kaggle_spotify_weekly_chart[1:5, 'Streams']
names(songs) <- kaggle_spotify_weekly_chart[1:5, 'Title']
barplot(height = artists,
main = 'Spotify streams of top 5 artists of the week chart'
)
barplot(height = songs,
main = 'Spotify streams of top 5 songs of the week chart')