Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove readr from dependencies #55

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ Imports:
stringr,
tidyr,
purrr,
readr,
tibble,
tidytext,
reshape2,
rlang
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
Suggests:
knitr,
rmarkdown,
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ importFrom(dplyr,mutate)
importFrom(purrr,map)
importFrom(purrr,map2)
importFrom(purrr,possibly)
importFrom(readr,read_lines)
importFrom(reshape2,melt)
importFrom(rlang,enquo)
importFrom(rvest,html_attr)
Expand Down
13 changes: 1 addition & 12 deletions R/genius_url.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ if(getRversion() >= "2.15.1") {
#' @importFrom rvest html_session html_node
#' @importFrom tidyr spread fill separate replace_na
#' @importFrom stringr str_detect str_extract
#' @importFrom readr read_lines

genius_url <- function(url, info = "title") {
# create a new session for scraping lyrics
Expand All @@ -46,17 +45,7 @@ genius_url <- function(url, info = "title") {
# trim white space
html_text(trim = TRUE) %>%
# use named vector for cleaning purposes
str_replace_all(cleaning()) %>% {
# sometimes there is only one line in a song
# if vector length == one it will try to read the text as a filepath
# add blank text if it that long
if (length(.) == 1) {
. <- c(.,"")
}
} %>%
# read lines into a data frame
read_lines() %>%

str_replace_all(cleaning()) %>%

# filter to only rows with content
.[str_detect(., "[[:alnum:]]")] %>%
Expand Down