-
Notifications
You must be signed in to change notification settings - Fork 15
/
README.Rmd
80 lines (57 loc) · 2.84 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = TRUE, warning = FALSE, message = FALSE, collapse = TRUE,
comment = "#>", fig.path = "man/figures/README-"
)
```
# geniusr <img src="man/figures/logo.png" width="160px" align="right" />
<!-- badges: start -->
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![CRAN status](https://www.r-pkg.org/badges/version/geniusr)](https://cran.r-project.org/package=geniusr)
[![DLs](http://cranlogs.r-pkg.org/badges/geniusr)](http://cran.rstudio.com/web/packages/geniusr/index.html)
[![Travis build Status](https://travis-ci.org/ewenme/geniusr.png)](https://travis-ci.org/ewenme/geniusr)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/ewenme/geniusr?branch=master&svg=true)](https://ci.appveyor.com/project/ewenme/geniusr)
[![Codecov test coverage](https://codecov.io/gh/ewenme/geniusr/branch/master/graph/badge.svg)](https://codecov.io/gh/ewenme/geniusr?branch=master)
<!-- badges: end -->
## Overview
Tools for working with the *Genius* (FKA *Rap Genius*) API.
- Genius Developers Site: [https://genius.com/developers](https://genius.com/developers)
- Genius API Docs: [https://docs.genius.com/](https://docs.genius.com/)
## Install
Get the latest stable version from CRAN...
```{r, eval = FALSE}
install.packages("geniusr")
```
...or install the development version from Github (recommended).
```{r install_dev, eval=FALSE}
remotes::install_github("ewenme/geniusr")
```
## Authenticate
1. [Create a Genius API client](https://genius.com/api-clients/new)
2. Generate a client access token from your [API Clients page](https://genius.com/api-clients)
3. Set your credentials in the System Environment variable `GENIUS_API_TOKEN` by calling the `genius_token()` function and entering your Genius Client Access Token when prompted.
## Use
Start with [the basics!](https://ewenme.github.io/geniusr/articles/geniusr.html)
### How many times did 'Ye say "good morning", on the track "Good Morning"?
```{r good_morning_count}
library(geniusr)
library(dplyr)
library(tidytext)
# get lyrics
get_lyrics_search(artist_name = "Kanye West",
song_title = "Good Morning") %>%
# get lyric bigrams
unnest_tokens(bigram, line, token = "ngrams", n = 2) %>%
# look for good morning
filter(bigram == "good morning") %>%
# count bigram frequency
nrow()
```
## Other
- Get citation information for geniusr in R with `citation(package = 'geniusr')`
- Please note that the geniusr project is released with a [Contributor Code of Conduct](https://ewenme.github.io/geniusr//CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
## Related work
- the [genius](https://github.com/JosiahParry/genius) package specialises in lyrics retrieval from Genius.