genius (version 2.2.3)

add_genius: Add lyrics to a data frame

Description

This function is to be used to build on a data frame with artist and album/track information. To use the function with a data frame of mixed type (albums and tracks), create another column that specifies type. The type values are `"album"`and `"lyrics"`.

Usage

add_genius(data, artist, title, type = c("album", "track", "lyrics"))

Arguments

data

This is a dataframe with one column for the artist name, and the other column being either the track title or the album title.

artist

This is the column which has artist title information

title

This is the column that has either album titles, track titles, or both.

type

This is a single value character string of either "album" or "track". This tells the function what kind of lyrics to pull. Alternatively, this can be a column with the value of "album" or "track" associated with each row. "lyric" can be used for backward compatibility.

Examples

Run this code
# NOT RUN {
#  # Albums only
#
#  artist_albums <- tibble::tribble(
#   ~artist, ~album,
#   "J. Cole", "KOD",
#   "Sampha", "Process"
# )
#
# add_genius(artist_albums, artist, album, type = "album")
#
#  # Individual Tracks only
#
#  artist_songs <- tibble::tribble(
#   ~artist, ~track,
#   "J. Cole", "Motiv8",
#   "Andrew Bird", "Anonanimal"
#  )
#
#  # Tracks and Albums
#  mixed_type <- tibble::tribble(
#    ~artist, ~album, ~type,
#    "J. Cole", "KOD", "album",
#    "Andrew Bird", "Proxy War", "track"
#  )
#
# add_genius(mixed_type, artist, album, type)
# add_genius(artist_songs, artist, track, type = "track")
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab