Rmarkdown


  1. Create a new .Rmd file. Choose the HTML file type.

  1. Modify the YAML header specifying:

  1. Modify the YAML to include a table of contents and knit the document.

  1. Specify in the YAML that you want a floating table of contents and knit the document.

  1. 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:

      • Pos : position of the song in the chart
      • P. : number of position gained since last week
      • Artist : name of the artist
      • Title : title of the song
      • Wks : number of weeks spent on the chart
      • Pk: peak position of the song
      • X.x..: number of times the peak position has been attained
      • Streams : number of streams of the song
      • Streams. : number of streams gained or lost since last week
      • Total : total number of streams

  1. Add a code chunk in the Data transformation section to:

  1. Add a code chunk to produce a barplot representing the streams of the top five artists in the chart. Do you need to specify names? Why?

  1. Add a code chunk to produce a barplot representing the streams of the top five songs in the chart.

  1. Add a “Conclusions” section to insert a plain text listing the titles of the top 5 songs in the chart.

  1. Create a new R Markdown file for exercises on plots done on 10/03/2025.
    Modify dimensions and parameters on the plots to achieve the best possible visualization and improve aestahetics.