Is there a better solution? Receiving “longer object length is not a multiple of shorter object length”Longer object length is not a multiple of shorter object length?Strange thing happening: longer object length is not a multiple of shorter object lengthlonger object length is not a multiple of shorter object lengthWarning: longer object length is not a multiple of shorter object lengthR warning - longer object length is not a multiple of shorter object lengthCorrect result but warnings that longer object length is not a multiple of shorter object lengthWarning: longer object length is not a multiple of shorter object length?R - longer object length is not a multiple of shorter object lengthlonger object length is not a multiple of shorter object length in r“longer object length is not a multiple of shorter object length”

Why does putting a dot after the URL remove login information?

Why can I log in to my facebook account with misspelled email/password

Why do cheap flights with a layover get more expensive when you split them up into separate flights?

Can I enter Switzerland with only my London Driver's License?

Not been paid even after reminding the Treasurer; what should I do?

Non-small objects in categories

Why do dragons like shiny stuff?

Tile the chessboard with four-colored triominoes

Why does capacitance not depend on the material of the plates?

Can I enter a rental property without giving notice if I'm afraid a tenant may be hurt?

Only charge capacitor when button pushed then turn on LED momentarily with capacitor when button released

Find a text string in a file and output only the rest of the text that follows it?

What is the probability of a biased coin coming up heads given that a liar is claiming that the coin came up heads?

Make a living as a math programming freelancer?

Ancients don't give a full level?

Repeated! Factorials!

How can I perform a deterministic physics simulation?

How do I get the =LEFT function in excel, to also take the number zero as the first number?

Why should I "believe in" weak solutions to PDEs?

How to realistically deal with a shield user?

Did silent film actors actually say their lines or did they simply improvise “dialogue” while being filmed?

Should I take out a personal loan to pay off credit card debt?

What could prevent players from leaving an island?

A verb for when some rights are not violated?



Is there a better solution? Receiving “longer object length is not a multiple of shorter object length”


Longer object length is not a multiple of shorter object length?Strange thing happening: longer object length is not a multiple of shorter object lengthlonger object length is not a multiple of shorter object lengthWarning: longer object length is not a multiple of shorter object lengthR warning - longer object length is not a multiple of shorter object lengthCorrect result but warnings that longer object length is not a multiple of shorter object lengthWarning: longer object length is not a multiple of shorter object length?R - longer object length is not a multiple of shorter object lengthlonger object length is not a multiple of shorter object length in r“longer object length is not a multiple of shorter object length”






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















This is my example.



user_id <- sample(seq(1,100),5000, TRUE)
friend_id <- sample(seq(1,100),5000, TRUE)
friends <- data.frame(user_id, friend_id)
friends <- friends %>%
filter(!user_id == friend_id)
friends <- friends %>% arrange(user_id) %>% distinct()

user_id <- sample(seq(1,100),10000, TRUE)
page_id <- sample(seq(1000,2000),10000, TRUE)
pages <- data.frame(user_id, page_id)
pages <- arrange(pages, user_id) %>% distinct()

popular <- friends %>%
left_join(pages, by = c("friend_id" = "user_id")) %>%
group_by(user_id, page_id) %>%
summarize(likes = n()) %>%
arrange(-likes) %>%
filter(!page_id %in% pages[pages$user_id == user_id,]$page_id)


My goal is to count the number of likes for each of the pages that a user's friend has liked. The last step is giving me this warning:




50: In pages$user_id == user_id : longer object length is not a
multiple of shorter object length




My goal in the last step is to filter out any page that the user has liked.



1) If I group by a column and then apply filter, will it apply to each of the grouped data frames separately? In other words, is it like having a for loop that says for (group in tbl) apply filter?



2) Will user_id give me the user_id according to each group? I guess this is an extension of 1.



3) I think it gives me the warning since pages$user_id is long and user_id is just one value. Is there a better solution or a more appropriate solution?










share|improve this question
































    0















    This is my example.



    user_id <- sample(seq(1,100),5000, TRUE)
    friend_id <- sample(seq(1,100),5000, TRUE)
    friends <- data.frame(user_id, friend_id)
    friends <- friends %>%
    filter(!user_id == friend_id)
    friends <- friends %>% arrange(user_id) %>% distinct()

    user_id <- sample(seq(1,100),10000, TRUE)
    page_id <- sample(seq(1000,2000),10000, TRUE)
    pages <- data.frame(user_id, page_id)
    pages <- arrange(pages, user_id) %>% distinct()

    popular <- friends %>%
    left_join(pages, by = c("friend_id" = "user_id")) %>%
    group_by(user_id, page_id) %>%
    summarize(likes = n()) %>%
    arrange(-likes) %>%
    filter(!page_id %in% pages[pages$user_id == user_id,]$page_id)


    My goal is to count the number of likes for each of the pages that a user's friend has liked. The last step is giving me this warning:




    50: In pages$user_id == user_id : longer object length is not a
    multiple of shorter object length




    My goal in the last step is to filter out any page that the user has liked.



    1) If I group by a column and then apply filter, will it apply to each of the grouped data frames separately? In other words, is it like having a for loop that says for (group in tbl) apply filter?



    2) Will user_id give me the user_id according to each group? I guess this is an extension of 1.



    3) I think it gives me the warning since pages$user_id is long and user_id is just one value. Is there a better solution or a more appropriate solution?










    share|improve this question




























      0












      0








      0








      This is my example.



      user_id <- sample(seq(1,100),5000, TRUE)
      friend_id <- sample(seq(1,100),5000, TRUE)
      friends <- data.frame(user_id, friend_id)
      friends <- friends %>%
      filter(!user_id == friend_id)
      friends <- friends %>% arrange(user_id) %>% distinct()

      user_id <- sample(seq(1,100),10000, TRUE)
      page_id <- sample(seq(1000,2000),10000, TRUE)
      pages <- data.frame(user_id, page_id)
      pages <- arrange(pages, user_id) %>% distinct()

      popular <- friends %>%
      left_join(pages, by = c("friend_id" = "user_id")) %>%
      group_by(user_id, page_id) %>%
      summarize(likes = n()) %>%
      arrange(-likes) %>%
      filter(!page_id %in% pages[pages$user_id == user_id,]$page_id)


      My goal is to count the number of likes for each of the pages that a user's friend has liked. The last step is giving me this warning:




      50: In pages$user_id == user_id : longer object length is not a
      multiple of shorter object length




      My goal in the last step is to filter out any page that the user has liked.



      1) If I group by a column and then apply filter, will it apply to each of the grouped data frames separately? In other words, is it like having a for loop that says for (group in tbl) apply filter?



      2) Will user_id give me the user_id according to each group? I guess this is an extension of 1.



      3) I think it gives me the warning since pages$user_id is long and user_id is just one value. Is there a better solution or a more appropriate solution?










      share|improve this question
















      This is my example.



      user_id <- sample(seq(1,100),5000, TRUE)
      friend_id <- sample(seq(1,100),5000, TRUE)
      friends <- data.frame(user_id, friend_id)
      friends <- friends %>%
      filter(!user_id == friend_id)
      friends <- friends %>% arrange(user_id) %>% distinct()

      user_id <- sample(seq(1,100),10000, TRUE)
      page_id <- sample(seq(1000,2000),10000, TRUE)
      pages <- data.frame(user_id, page_id)
      pages <- arrange(pages, user_id) %>% distinct()

      popular <- friends %>%
      left_join(pages, by = c("friend_id" = "user_id")) %>%
      group_by(user_id, page_id) %>%
      summarize(likes = n()) %>%
      arrange(-likes) %>%
      filter(!page_id %in% pages[pages$user_id == user_id,]$page_id)


      My goal is to count the number of likes for each of the pages that a user's friend has liked. The last step is giving me this warning:




      50: In pages$user_id == user_id : longer object length is not a
      multiple of shorter object length




      My goal in the last step is to filter out any page that the user has liked.



      1) If I group by a column and then apply filter, will it apply to each of the grouped data frames separately? In other words, is it like having a for loop that says for (group in tbl) apply filter?



      2) Will user_id give me the user_id according to each group? I guess this is an extension of 1.



      3) I think it gives me the warning since pages$user_id is long and user_id is just one value. Is there a better solution or a more appropriate solution?







      r






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 4:21







      Cauder

















      asked Mar 27 at 4:03









      CauderCauder

      19211 bronze badges




      19211 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0














          Is this what you are looking for:



          pages_agg <- pages %>%
          group_by(user_id) %>%
          summarise(likes = n())

          left_join(friends, pages_agg, by = c("friend_id" = "user_id")) %>%
          head()
          user_id friend_id likes
          1 1 44 107
          2 1 76 90
          3 1 36 116
          4 1 4 110
          5 1 57 93
          6 1 32 96





          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',
            autoActivateHeartbeat: false,
            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%2f55369618%2fis-there-a-better-solution-receiving-longer-object-length-is-not-a-multiple-of%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









            0














            Is this what you are looking for:



            pages_agg <- pages %>%
            group_by(user_id) %>%
            summarise(likes = n())

            left_join(friends, pages_agg, by = c("friend_id" = "user_id")) %>%
            head()
            user_id friend_id likes
            1 1 44 107
            2 1 76 90
            3 1 36 116
            4 1 4 110
            5 1 57 93
            6 1 32 96





            share|improve this answer





























              0














              Is this what you are looking for:



              pages_agg <- pages %>%
              group_by(user_id) %>%
              summarise(likes = n())

              left_join(friends, pages_agg, by = c("friend_id" = "user_id")) %>%
              head()
              user_id friend_id likes
              1 1 44 107
              2 1 76 90
              3 1 36 116
              4 1 4 110
              5 1 57 93
              6 1 32 96





              share|improve this answer



























                0












                0








                0







                Is this what you are looking for:



                pages_agg <- pages %>%
                group_by(user_id) %>%
                summarise(likes = n())

                left_join(friends, pages_agg, by = c("friend_id" = "user_id")) %>%
                head()
                user_id friend_id likes
                1 1 44 107
                2 1 76 90
                3 1 36 116
                4 1 4 110
                5 1 57 93
                6 1 32 96





                share|improve this answer













                Is this what you are looking for:



                pages_agg <- pages %>%
                group_by(user_id) %>%
                summarise(likes = n())

                left_join(friends, pages_agg, by = c("friend_id" = "user_id")) %>%
                head()
                user_id friend_id likes
                1 1 44 107
                2 1 76 90
                3 1 36 116
                4 1 4 110
                5 1 57 93
                6 1 32 96






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 6:00









                SonnySonny

                2,7051 gold badge6 silver badges17 bronze badges




                2,7051 gold badge6 silver badges17 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369618%2fis-there-a-better-solution-receiving-longer-object-length-is-not-a-multiple-of%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

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript