Skip to content

dzulfiqarfr/24.02_katadata_music_taste

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Music taste

The code and data to produce Katadata's "Selera Musik di Indonesia Cenderung Lagu Sedih" story.

Note

The analysis has been updated for reproduction. Hence, the data in this repository are expected to be different from the ones that originally appear in the story.

Getting started

You need R (and RStudio) to run this analysis project.

Since this repository is an R project, open 24.02_katadata_music_taste.Rproj to launch it.

The project uses the renv package to manage dependencies and ensures reproducibility.

Spotify setup

The analysis uses data such as playlists and audio features from Spotify, which are available through its Application Programming Interface (API).

You need to set up a Spotify account and create an app for its Web API on the developer platform (see Getting started with Web API). The app is necessary as you'll need its client ID and secret to get an access token to authorize your request.

Then, you need to supply the client ID and secret to the spotifyr package (see Authorization code flow).

Example

You can produce the analysis by running run_all.R in the src folder. This is the controller script that runs other scripts to perform every step of the analysis from start to finish.

Caution

You may hit the API's rate limit when running the scripts multiple times within a short period (see Rate Limits). In such cases, you have to wait for several hours before you can successfully make a request again.

You can run the script in your RStudio interactively or using the console like so.

source("src/run_all.R")

You can also run each script individually.

License

This project is licensed under the MIT License.