Til I Die: Seeking new music
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
I’ve been following the tweets from an account called Albums You Must Hear @Albums2Hear. Each tweet is an album recommended by the account owner. I’m a sucker for lists of Albums That I Must Hear Before I Die since I’m always interested in new (or not so new) music recommendations.
I wanted to assemble a list of the albums that I don’t have from this account and I was able to do so using R.
Using rtweet, it was possible to pull a list of all the albums and reorganise them so that I had a csv containing the albums with the artist and year. I could then use this to compare with a list of albums from my iTunes library. A snippet of the retrieved records is shown here (full list is here).
3
|
The Who
|
Live at Leeds
|
1970
|
4
|
Manfred Mann’s Earth Band
|
Solar Fire
|
1973
|
5
|
The Hives
|
Your New Favourite Band
|
2001
|
6
|
The Waterboys
|
This is the Sea
|
1985
|
7
|
Scott Walker
|
Scott 3
|
1969
|
8
|
Miles Davis
|
Kind of Blue
|
1959
|
The code for retrieval is here. The output is csv can be used to compare with a list of your own records.
library(rtweet) library(httpuv) library(stringr) all_tweets <- get_timeline("Albums2Hear", n = 1500) albums <- all_tweets$text albums <- gsub("#albumsyoumusthear ","",albums) tempdf <- as.data.frame(str_split_fixed(albumV, " - ", 3)) colnames(tempdf) <- c("Artist","Album","YearURL") tempdf2 <- as.data.frame(str_split_fixed(tempdf$YearURL, " ", 2)) colnames(tempdf2) <- c("Year","URL") df <- data.frame(y$Artist,y$Album,z$Year) colnames(df) <- c("Artist","Album","Year") write.csv(df,file = "albums2hear.csv")
Thanks to whoever runs the account – they ask for support here.
—
The post title comes from ‘Til I Die by The Beach Boys from Sunflower/Surf’s Up.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.