knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(tsortmusicr)
This is a package designed to help explore data from the great websites https://tsort.info/ and https://chart2000.com/.
Note that usage of data from tsort.info and chart2000.com is free under the following conditions:
Acknowledge the source.
Prominently link to https://tsort.info or https://chart2000.com respectively.
Always include version number.
The following functions to read data from tsort.info are available:
tsm_read_songs(): Wrapper around readr::read_csv to read Top 5000 songs from tsort.info, with convenient defaults (url, file name, NA encoding).
tsm_read_albums(): Wrapper around readr::read_csv to read Top 3000 albums from tsort.info, with convenient defaults.
tsm_read_chart(): Wrapper around readr::read_csv to read full chart data from tsort.info, with convenient defaults.
tsm_get_version() retrieves the current version of the data at https://tsort.info/ as noted at this web address:
https://tsort.info/music/faq_version_numbers.htm
The following functions to read data from chart2000.com are available:
ch2k_read_songs(): Wrapper around readr::read_csv to read Top 50 songs per month from chart2000.com, with convenient defaults (url, file name, NA encoding).
ch2k_read_albums(): Wrapper around readr::read_csv to read Top 50 albums per month from chart2000.com, with convenient defaults.
ch2k_get_version() retrieves the current version of the data at https://chart2000.com/ as noted at this web address:
https://chart2000.com/about.htm
Note there is currently no equivalent to tsm_read_chart()
to import the full data set. chart2000.com offers data containing top artists and songs that have their own pages, as well as songs of the year and albums of the year, featuring the top 100 per year. Importing these datasets is currently not supported by the package.
The following plotting functions are available:
tsm_ggbox(data): ggplot2 boxplot additionally showing original data points using a slightly customized theme based on theme_bw().
tsm_ggbox(albums)
tsm_ggbox_plotly(p): interactive plotly diagram showing mouse-over information.
p <- tsm_ggbox(albums)
tsm_ggbox_plotly(p)
tsm_get_version() albums <- tsm_read_albums() attr(albums, "version") tsm_ggbox(albums)
You can make an interactive plotly chart like so (not carried out here because of file sizes):
p <- tsm_ggbox(albums) tsm_ggbox_plotly(p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.