Obtaining data from Spotify Top Charts using spotifyr
up vote
2
down vote
favorite
I'm trying to obtain the audio features for the top 200 charts of all of 2017 using the spotifyr package on R, I tried:
days<- spotifycharts::chartdaily()
for (i in days)
spotifycharts::chart_top200_daily(region = "global",days = "days[i]")
to obtain the top 200 daily for all of 2017, but I was unable to do it.
Can someone help me? :(
r loops spotify
add a comment |
up vote
2
down vote
favorite
I'm trying to obtain the audio features for the top 200 charts of all of 2017 using the spotifyr package on R, I tried:
days<- spotifycharts::chartdaily()
for (i in days)
spotifycharts::chart_top200_daily(region = "global",days = "days[i]")
to obtain the top 200 daily for all of 2017, but I was unable to do it.
Can someone help me? :(
r loops spotify
1
You have days within quotes. Try removing the quotes: chart_top200_daily(region = "global", days = days[i])
– Harro Cyranka
Nov 11 at 18:49
Tried that, but did not work... I'm trying to make a loop to obtain the entire year of top 200 daily
– Gerardo Garza
Nov 11 at 19:01
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm trying to obtain the audio features for the top 200 charts of all of 2017 using the spotifyr package on R, I tried:
days<- spotifycharts::chartdaily()
for (i in days)
spotifycharts::chart_top200_daily(region = "global",days = "days[i]")
to obtain the top 200 daily for all of 2017, but I was unable to do it.
Can someone help me? :(
r loops spotify
I'm trying to obtain the audio features for the top 200 charts of all of 2017 using the spotifyr package on R, I tried:
days<- spotifycharts::chartdaily()
for (i in days)
spotifycharts::chart_top200_daily(region = "global",days = "days[i]")
to obtain the top 200 daily for all of 2017, but I was unable to do it.
Can someone help me? :(
r loops spotify
r loops spotify
edited Nov 11 at 18:55
Harro Cyranka
1,045513
1,045513
asked Nov 11 at 18:31
Gerardo Garza
161
161
1
You have days within quotes. Try removing the quotes: chart_top200_daily(region = "global", days = days[i])
– Harro Cyranka
Nov 11 at 18:49
Tried that, but did not work... I'm trying to make a loop to obtain the entire year of top 200 daily
– Gerardo Garza
Nov 11 at 19:01
add a comment |
1
You have days within quotes. Try removing the quotes: chart_top200_daily(region = "global", days = days[i])
– Harro Cyranka
Nov 11 at 18:49
Tried that, but did not work... I'm trying to make a loop to obtain the entire year of top 200 daily
– Gerardo Garza
Nov 11 at 19:01
1
1
You have days within quotes. Try removing the quotes: chart_top200_daily(region = "global", days = days[i])
– Harro Cyranka
Nov 11 at 18:49
You have days within quotes. Try removing the quotes: chart_top200_daily(region = "global", days = days[i])
– Harro Cyranka
Nov 11 at 18:49
Tried that, but did not work... I'm trying to make a loop to obtain the entire year of top 200 daily
– Gerardo Garza
Nov 11 at 19:01
Tried that, but did not work... I'm trying to make a loop to obtain the entire year of top 200 daily
– Gerardo Garza
Nov 11 at 19:01
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
It works, if you turn days from tibble
into vector:
days <- unlist(chart_daily())
lapply(days[1:3], function(i) chart_top200_daily("global", days = i))
But it parse data badly, so there will be problems with variable names, etc:
# A tibble: 6 x 5
x1 x2 x3 note.that.these.figures.are.generated.… x5
<int> <chr> <chr> <int> <chr>
1 NA Track Name Artist NA URL
2 1 thank u, next Ariana… 8293841 https://open.spoti…
3 2 Taki Taki (with S… DJ Sna… 5467625 https://open.spoti…
4 3 MIA (feat. Drake) Bad Bu… 3955367 https://open.spoti…
5 4 Happier Marshm… 3357435 https://open.spoti…
6 5 BAD XXXTEN… 3131745 https://open.spoti…
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
It works, if you turn days from tibble
into vector:
days <- unlist(chart_daily())
lapply(days[1:3], function(i) chart_top200_daily("global", days = i))
But it parse data badly, so there will be problems with variable names, etc:
# A tibble: 6 x 5
x1 x2 x3 note.that.these.figures.are.generated.… x5
<int> <chr> <chr> <int> <chr>
1 NA Track Name Artist NA URL
2 1 thank u, next Ariana… 8293841 https://open.spoti…
3 2 Taki Taki (with S… DJ Sna… 5467625 https://open.spoti…
4 3 MIA (feat. Drake) Bad Bu… 3955367 https://open.spoti…
5 4 Happier Marshm… 3357435 https://open.spoti…
6 5 BAD XXXTEN… 3131745 https://open.spoti…
add a comment |
up vote
0
down vote
It works, if you turn days from tibble
into vector:
days <- unlist(chart_daily())
lapply(days[1:3], function(i) chart_top200_daily("global", days = i))
But it parse data badly, so there will be problems with variable names, etc:
# A tibble: 6 x 5
x1 x2 x3 note.that.these.figures.are.generated.… x5
<int> <chr> <chr> <int> <chr>
1 NA Track Name Artist NA URL
2 1 thank u, next Ariana… 8293841 https://open.spoti…
3 2 Taki Taki (with S… DJ Sna… 5467625 https://open.spoti…
4 3 MIA (feat. Drake) Bad Bu… 3955367 https://open.spoti…
5 4 Happier Marshm… 3357435 https://open.spoti…
6 5 BAD XXXTEN… 3131745 https://open.spoti…
add a comment |
up vote
0
down vote
up vote
0
down vote
It works, if you turn days from tibble
into vector:
days <- unlist(chart_daily())
lapply(days[1:3], function(i) chart_top200_daily("global", days = i))
But it parse data badly, so there will be problems with variable names, etc:
# A tibble: 6 x 5
x1 x2 x3 note.that.these.figures.are.generated.… x5
<int> <chr> <chr> <int> <chr>
1 NA Track Name Artist NA URL
2 1 thank u, next Ariana… 8293841 https://open.spoti…
3 2 Taki Taki (with S… DJ Sna… 5467625 https://open.spoti…
4 3 MIA (feat. Drake) Bad Bu… 3955367 https://open.spoti…
5 4 Happier Marshm… 3357435 https://open.spoti…
6 5 BAD XXXTEN… 3131745 https://open.spoti…
It works, if you turn days from tibble
into vector:
days <- unlist(chart_daily())
lapply(days[1:3], function(i) chart_top200_daily("global", days = i))
But it parse data badly, so there will be problems with variable names, etc:
# A tibble: 6 x 5
x1 x2 x3 note.that.these.figures.are.generated.… x5
<int> <chr> <chr> <int> <chr>
1 NA Track Name Artist NA URL
2 1 thank u, next Ariana… 8293841 https://open.spoti…
3 2 Taki Taki (with S… DJ Sna… 5467625 https://open.spoti…
4 3 MIA (feat. Drake) Bad Bu… 3955367 https://open.spoti…
5 4 Happier Marshm… 3357435 https://open.spoti…
6 5 BAD XXXTEN… 3131745 https://open.spoti…
answered Nov 11 at 22:45
utubun
1,1741711
1,1741711
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251861%2fobtaining-data-from-spotify-top-charts-using-spotifyr%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You have days within quotes. Try removing the quotes: chart_top200_daily(region = "global", days = days[i])
– Harro Cyranka
Nov 11 at 18:49
Tried that, but did not work... I'm trying to make a loop to obtain the entire year of top 200 daily
– Gerardo Garza
Nov 11 at 19:01