Join Data with dplyr in R (6 Examples) | inner, left, righ, full, semi & anti

Поделиться
HTML-код
  • Опубликовано: 21 авг 2024
  • In this video I'm showing you how to merge data frames with the dplyr package in R. The video includes six different join functions, i.e. inner_join, left_join, right_join, full_join, and anti_join. For each function, I show a reproducible example as well as a graphic, which illustrates how the data is merged.
    Also check out this tutorial on the join dplyr functions: statisticsglob...
    In this tutorial, you can find further examples, which are a bit more complex (e.g. merging multiple data frame or joining by multiple columns).
    Have fun with the video and let me know in the comments, if you have any feedback or questions.

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

  • @rakhimebrams3912
    @rakhimebrams3912 4 года назад +9

    The all in one explaination at 1.00 min,, thats all i needed. thank you.....! best explaination.

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

      Awesome to hear that you found what you were looking for Rakhim! Also, Thanks a lot for the kind words! :)

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

      😊000pp⁰​@@StatisticsGlobe

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

    Even without any explanation, your diagram in 0:50 self-explain itself. Very CLEAR! Thanks for your work.

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

      Glad it was helpful! Thanks for the kind words!

  • @carlwratten6200
    @carlwratten6200 4 года назад +3

    One of the best videos to understand what the different joins are.

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

      Thanks Carl, I'm glad that you liked it :)

  • @macanbhaird1966
    @macanbhaird1966 4 года назад +10

    Excellent overview. I was going around in circles and you explained this very well. Thank you!

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

      Thanks a lot for your comments here and at the homepage Andrew. It's awesome to get such positive feedback!

  • @davebowman9000
    @davebowman9000 11 месяцев назад +1

    Thanks! DataCamp kind of glosses over this and I got lost. I prefer the visual explanation you gave way better!

    • @matthias.statisticsglobe
      @matthias.statisticsglobe 11 месяцев назад

      Hey Dave, thanks for the feedback. Glad to hear that the visual explanations in the videos are helpful for you!

  • @jezdel6298
    @jezdel6298 Год назад +1

    thanks for this video. very simple explanation. I love that you indicate that this function is in dplyr package. whenever I find other new functions that interest me, it is frustrating to see online discussions that doesn't always indicate from which package the function comes from.

    • @matthias.statisticsglobe
      @matthias.statisticsglobe Год назад

      Hi! Thanks a lot for the wonderful response, glad to hear that you like our instructions. If you have any other suggestions to improve them, please let us know!

  • @joelrodriguez1232
    @joelrodriguez1232 4 года назад +1

    Excellent video. I now understand SQL better by watching a video on R.

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

      Haha that's great to hear! :D Thanks for the comment!

  • @jetcurioso6349
    @jetcurioso6349 Год назад +2

    I really love this kind of tutorial. Just sweet & concise explanation

  • @MrRamaeri
    @MrRamaeri 2 года назад +2

    Really excellent video, many thanks; you are the best R programmer. Very nice very good 👍 🥇🥇🥇🥇🥇🥇💯💯💯💯

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

      Wow, thanks a lot for the very kind words Ram! Glad you like my videos! :)

  • @Adeyeye_seyison
    @Adeyeye_seyison Год назад +1

    Thanks a million sir for all you do and share...

    • @matthias.statisticsglobe
      @matthias.statisticsglobe Год назад

      Hey Seyison, thank you very much for the feedback and your support! Glad the content is helpful!

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

    Thank you genious!!! I needed this, since I am doing my first steps in Data Science. Hugs from Argentina!

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

      Thanks a lot Maria, glad to hear that it helped! Greetings back to Argentina and a happy new year from Germany

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

    Thank you so much.
    Simple & neat with beautiful explanation!

  • @zahiissam
    @zahiissam 4 года назад +1

    Very Good explanation!keep sharing your knowledge.Thank you

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

      Thanks a lot for the motivating words Issam :)

  • @Faycal59
    @Faycal59 Год назад +1

    Thank you for the tuto. it's useful

  • @MrWonszBoa
    @MrWonszBoa 3 месяца назад +1

    very helpful, thank you.

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

      That's great to hear. Glad it was helpful!

  • @liviasacchi5584
    @liviasacchi5584 4 года назад +1

    Very clear and concise, thank you.
    So useful!

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

      Thank you Livia, great to hear that it helped! :) Regards, Joachim

  • @meseretmuche6984
    @meseretmuche6984 Год назад +1

    remarkable lecture
    Dear Dr, please give us a video tutorial related to meta analysis of continuous data for ecological data management

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

      Hello Meseret,
      Thank you for your feedback. We are going to consider your suggestion for our future work.
      Regards,
      Cansu

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

    Wow. Thank you so much. Great summary

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

    Excellent video, thanks for sharing.

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

    Thanks for the tutorials they are very helpful. Can you do a video on calculating number of days in a month e.g.forms are logged on a monthly basis, however, I want to track how many are processed in 30 days.

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

      Hey Boitshoko, thank you for the kind words, and for the tutorial request. I've just created such a tutorial on the website: statisticsglobe.com/find-out-number-days-month-r Regards, Joachim

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

    Great video - helped me use join function

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

      Thanks for the nice comment Binaya! Great to hear!

  • @the_escapist
    @the_escapist 4 года назад +1

    Perfect explanation ...Thank you so much!

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

    thank you very much sir.

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

    I love the visuals. Very helpfull!

  • @ryanschneider8958
    @ryanschneider8958 4 года назад +1

    fantastic explanation!

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

    Thank you. it was really helpful.

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

    thanks, thanks, thanks !!!!

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

    Thank you very much!

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

    Perfect, thank you

  • @deeptimittal6547
    @deeptimittal6547 4 месяца назад +1

    Nice video. I want to know the rationale behind using stringsasfactors.

    • @StatisticsGlobe
      @StatisticsGlobe  4 месяца назад

      Thank you, glad you like it! When this video was made, character strings were automatically converted to factors in data.frame creation. To retain them as characters, I used stringsAsFactors = FALSE. This behavior has been updated in newer R versions, eliminating the need for this specification.

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

    Thanks :)

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

    I'm a recent subscriber to your channel. Love your content. I have a question, what is the difference between bind_row and inner_join?

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

      Hey Wolfgang, bind_row adds rows to a data frame without changing the order of the values. In contrast, the join functions add columns based on an ID. Regards, Joachim

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

      @@StatisticsGlobe Thank you for the answer! Love your content I'm learning a lot from your videos!

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

      That's really great to hear! Thanks for the kind words Wolfgang!

  • @willhelm95
    @willhelm95 4 года назад +1

    Good video! Thanks!

  • @jakobtraneibsen3016
    @jakobtraneibsen3016 4 года назад

    What Liva Sacchi said. Thank you very much.

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

      You are welcome Jakob and thanks for the comment! :)

  • @andremeiner1365
    @andremeiner1365 4 года назад +1

    Bomben Video!

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

    Thanks

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

    Great

  • @efrainrodriguez1324
    @efrainrodriguez1324 9 месяцев назад +1

    Why would one get duplicate cases for left_join

    • @cansustatisticsglobe
      @cansustatisticsglobe 9 месяцев назад

      Hello!
      Are you getting undesired duplicates? If so, consider the following solutions, to avoid unintentional duplication:
      Always inspect your data before and after the join.
      Understand the nature of the columns you're joining on.
      Consider using inner_join(), semi_join(), or anti_join() if they are more appropriate for your specific use case.
      If you expect one-to-one matches, but get duplicates, investigate the reasons before proceeding with further analysis.
      Best,
      Cansu

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

    There is a way to full_anti_join?
    exemple, go to the minute 8:33
    I would like something like:
    ID X1 X2
    1 a2 NA
    2 NA b2
    In other words: all that are not in both tables. A exlusive full join.
    the result will be same that your in full_join except by the second line bcs the second line has data in both tables.
    ofc for this single exemple need just filter a full join where ID != 2 .
    But i not mean about a filter i really would like a full_anti_join bringing values of 2 tables that are exclusives.

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

      Hey Aquila, I'm not sure if this would be provided as a function itself, but you may use the following R code to get your desired result:
      data_full_anti

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

      @@StatisticsGlobe tyvm :D

  • @k.charith373
    @k.charith373 3 года назад +1

    what if need to use more than one reference to merge? Please educate me.. thank you sir

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

      Hey, what do you mean with "reference"? Regards, Joachim

    • @k.charith373
      @k.charith373 3 года назад +1

      @@StatisticsGlobe the merge process is done using a common coloum (e.g. Common ID), what if I need to use two coloums to merge?

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

      Thanks for the clarification! Is this what you are looking for? statisticsglobe.com/merge-data-frames-by-two-id-columns-in-r

    • @k.charith373
      @k.charith373 3 года назад +1

      @@StatisticsGlobe exactly sir... thanks, this is great.. :)

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

      You are very welcome, glad it helped! :)

  • @tvvt005
    @tvvt005 7 месяцев назад

    What are meant by vertical and horizontal merges in R?

    • @Ifeanyi.StatisticsGlobe
      @Ifeanyi.StatisticsGlobe 7 месяцев назад

      Hi Tvvt005. Vertical merging of two tables means combining two tables by their rows. That is, stacking one table on top of the other table. A function like rbind( ) can be used to perform this operation. For the operation to be successful, both tables must have the same number of columns.
      Horizontal merging of two tables means combining two tables by their columns. A function like cbind( ) can be used to accomplish this. For this operation to be successful, both tables must have the same number of rows.
      I hope this helps!

  • @WahranRai
    @WahranRai 4 года назад

    Too light (not too much data.) your exemple !

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

      Hey WahranRai, Thank you for the feedback. I kept the example as simple as possible to make it easier to unterstand. However, you could apply exactly the same R codes to more complex data sets.