knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

lastfmr

R-CMD-check

The goal of lastfmr is to simplify the work of interacting with the last.fm API to get information about your favourite artists, albums, and collecting scrobbles in a tidy format. Pagination is taken care of for you and the data is organized with sensible column names and formatting.

Installation

You can install the development version of lastfmr from GitHub with:

devtools::install_github("bkkkk/lastfmr")

Basic usage

library(lastfmr)
library(tidyverse)
library(glue)
library(ggplot2)

lastfmr::chart_get_top_tracks(.n_pages = 10) %>%
  mutate(
    label = glue::glue("{name} by {artist}")
  ) %>%
  top_n(10, playcount) %>%
  ggplot(aes(reorder(label, playcount), playcount)) + geom_col() +
  coord_flip() + labs(
    y = "Play Count", x = "", title = "BTS hold the Top 5 most played songs on last.fm",
    subtitle = "Top 10 Songs"
  )

The package provides functions for each of the endpoints and a generic API function. For each of the endpoints there are 2 functions:

The function names are mapped directly from the endpoint name

Below is a summary of endpoint support:

| Endpoint | Raw | Tidy | |----------------------|--------------------|--------------------| | album.getInfo | :heavy_check_mark: | :x: | | album.search | :heavy_check_mark: | :x: | | chart.getTopArtists | :heavy_check_mark: | :heavy_check_mark: | | chart.getTopTags | :heavy_check_mark: | :heavy_check_mark: | | chart.getTopTracks | :heavy_check_mark: | :heavy_check_mark: | | track.search | :heavy_check_mark: | :x: | | track.getInfo | :heavy_check_mark: | :x: | | track.getSimilar | :heavy_check_mark: | :x: | | user.getRecentTracks | :heavy_check_mark: | :heavy_check_mark: | | user.getTopAlbums | :heavy_check_mark: | :heavy_check_mark: | | user.getTopArtists | :heavy_check_mark: | :heavy_check_mark: | | user.getTopTracks | :heavy_check_mark: | :x: | | user.getFriends | :heavy_check_mark: | :x: | | user.getInfo | :heavy_check_mark: | :x: | | user.getLovedTracks | :heavy_check_mark: | :x: | | user.getPersonalTags | :heavy_check_mark: | :x: | | user.getTopTags | :heavy_check_mark: | :x: | | artist.getInfo | :heavy_check_mark: | :x: | | artist.getSimilar | :heavy_check_mark: | :x: | | artist.getTags | :heavy_check_mark: | :x: | | artist.getTopAlbums | :heavy_check_mark: | :x: | | artist.getTopTracks | :heavy_check_mark: | :x: | | artist.search | :heavy_check_mark: | :x: |



bkkkk/lastfmr documentation built on Sept. 4, 2022, 7:03 a.m.