Created
June 24, 2019 16:24
-
-
Save JosiahParry/f5e8384dd9e8f8903640bb7ae319807c to your computer and use it in GitHub Desktop.
Create version of `get_track_audio_features()` which takes artist name and title.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create function for getting song features | |
track_audio_features <- function(artist, title, type = "track") { | |
search_results <- search_spotify(paste(artist, title), type = type) | |
track_audio_feats <- get_track_audio_features(search_results$id[[1]]) %>% | |
dplyr::select(-id, -uri, -track_href, -analysis_url) | |
return(track_audio_feats) | |
} | |
# create a version of this function which can handle errors | |
possible_af <- possibly(track_audio_features, otherwise = tibble()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment