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? :(










share|improve this question



















  • 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














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? :(










share|improve this question



















  • 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












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? :(










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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












  • 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












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…





share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    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

























    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…





    share|improve this answer
























      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…





      share|improve this answer






















        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…





        share|improve this answer












        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…






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 22:45









        utubun

        1,1741711




        1,1741711



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            ReactJS Fetched API data displays live - need Data displayed static

            政党