Merge Data Frames by Two ID Columns in R (2 Examples) | merge() vs. join() Function of dplyr Package

Поделиться
HTML-код
  • Опубликовано: 6 ноя 2024

Комментарии • 36

  • @robertjones3727
    @robertjones3727 3 года назад +2

    You have a very effective teaching style which I appreciate. Clear concise practical examples. Thank you.

    • @StatisticsGlobe
      @StatisticsGlobe  3 года назад

      Thank you very much for the great feedback Robert! :)

  • @kelseymariel2127
    @kelseymariel2127 3 года назад +2

    Love your channel. I’m new to R and will need to merge two data frames shortly for a project I am doing. This was an excellent primer on the prices. Thank you!

    • @StatisticsGlobe
      @StatisticsGlobe  3 года назад +1

      Awesome, thank you for the positive feedback Kelsey!

  • @paulalezama5407
    @paulalezama5407 3 месяца назад

    Thank you, these are helpful overall. Though, I wish people will explain how to solve problems, all of the examples are so neat that one encounters issues and have not idea how to solve.

  • @agsoutas
    @agsoutas 3 года назад +3

    Thanks for the tutorial Joachim, always great for keeping my R skills sharp!!

    • @StatisticsGlobe
      @StatisticsGlobe  3 года назад +1

      Thanks for the comment AG! :)

    • @agsoutas
      @agsoutas 3 года назад +1

      @@StatisticsGlobe You are very welcome, I am looking forward your next tutorial!!

    • @StatisticsGlobe
      @StatisticsGlobe  3 года назад +1

      It will be released today at 4 PM :)

    • @agsoutas
      @agsoutas 3 года назад +1

      @@StatisticsGlobe Awsome

  • @djrisks
    @djrisks 5 месяцев назад

    Thanks for this. I'm new to R, and I was able to understand this.

    • @micha.statisticsglobe
      @micha.statisticsglobe 5 месяцев назад

      Thank you very much for your kind feedback. Glad it helped! 🙂

  • @bridgettsmith7206
    @bridgettsmith7206 2 года назад +1

    Thank you for the video. I enjoyed this quick lesson

  • @rehanvillani3027
    @rehanvillani3027 2 года назад +1

    Very clear, thanks, helped a lot!

  • @yousif_alyousifi
    @yousif_alyousifi 2 года назад +1

    If the names of the columns are the same in both data frames. Can we use rbind or we would use the merge function?

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      Hey Yousif, this depends on your desired output. If you want to combine data by certain IDs of your observations, you would use a merge. If you would simply like to stack your data on top of each other, you would use rbind. Regards, Joachim

    • @duyanhao9438
      @duyanhao9438 Год назад

      @@StatisticsGlobe hi, i have 2 data frames and I want to merge by the date columns, but the names of 2 columns are different, "date_activity" & "date_sleep" . How can I merge them then?

  • @Enjoytheshow-7
    @Enjoytheshow-7 2 года назад +1

    hey Globe, if I merge data frames by either ID1 or ID2, is it possible? Now I have two datasets. Some people gave their phone number,some people gave their email address, some people gave both, some people put their email address into the cell of phone number. I have merge these two data set.

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      Hey, you might combine your two ID columns using the paste() function, and then you might use this combined ID to merge your data sets. Regards, Joachim

    • @Enjoytheshow-7
      @Enjoytheshow-7 2 года назад +1

      @@StatisticsGlobe hey Gloe, thank you for your reply. let me try it tomorrow and I will let you know the whether it works.

  • @jarrodsmith5440
    @jarrodsmith5440 2 года назад

    Very useful video! Thank you so much!

  • @caduguimaraes
    @caduguimaraes 3 года назад +2

    Nice one

  • @seagul
    @seagul 2 года назад +1

    My merge works and there is a new file with all the columns but not data. (it worked in a different merge)

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      Hey Tom, could you share the structure of your data and your code?

    • @seagul
      @seagul 2 года назад +1

      @@StatisticsGlobe thank you for the reply Joachim. Here is my Code
      wiki

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      What is returned when you run this:
      wiki %
      select(-one_of(col_remove))
      colnames(isoo)

    • @seagul
      @seagul 2 года назад +1

      > head(wiki)
      Land Haushaltsgroesse Haushaltanzahl
      1 China 2.70 522689264
      2 India 4.57 299727860
      3 United States 2.49 132736055
      4 Indonesia 3.86 69855344
      5 Brazil 3.31 64124398
      6 Russia 2.58 56771478
      > head(isoo)
      ISO Land
      1 AFG Afghanistan
      2 ALA Aland Islands
      3 ALB Albania
      4 DZA Algeria
      5 ASM American Samoa
      6 AND Andorra

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      Hey Tom, sorry for the late reply, for some reason your comment was blocked by RUclips. Do you still need help with this? Regards, Joachim

  • @SudhirKumar-ry4gk
    @SudhirKumar-ry4gk 3 года назад +1

    Great nice video ...

    • @StatisticsGlobe
      @StatisticsGlobe  3 года назад

      Thank you very much Sudhir!

    • @SudhirKumar-ry4gk
      @SudhirKumar-ry4gk 3 года назад +1

      @@StatisticsGlobe waiting for video on data through which we can understand and apply the same on real life.hope you will think about it and get time soon to make video on it.
      Thanks for your support