Video není dostupné.
Omlouváme se.

What's the difference between a matrix, data frame, and tibble in R? (CC180)

Sdílet
Vložit
  • čas přidán 18. 08. 2024
  • Do you know when to use a matrix, data frame, or tibble in R? Do you know how to use each or even what the differences are between these three types of variables? In this episode of Code Club, Pat will show you how to convert the same data between the different types using base R functions. Finally, he'll bring back the tidyverse to show why he prefers to work with data frames as tibbles. This is part of a series of videos demonstrating how to functions from base R to make these data compatible with tools from the tidyverse
    You can find my blog post for this episode at www.riffomonas....
    The data were generated in our Kozich et al. 2013 paper (doi.org/10.1128...) using samples from the Schloss et al. 2012 paper (doi.org/10.4161....
    #baseR #tibbles #Rstats
    Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at shop.riffomona... to get practice problems, tips, and insights.
    If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at riffomonas.org...
    You can also find complete tutorials for learning R with the tidyverse using...
    Microbial ecology data: www.riffomonas...
    General data: www.riffomonas...
    0:00 Matrices, data frames, and tibbles what's the difference?
    0:50 Working with R's matrix variables
    2:26 Working with R's distance matrix variables
    4:55 Working with R's data frame variables
    13:16 Working with R/tidyverse's tibble variables

Komentáře • 22

  • @TheMaplestoryGuide
    @TheMaplestoryGuide Před 2 lety +1

    Awesome video! Just jumped into R recently, and these concepts have been stumping me (tidyverse vs. base R). But feeling more confident now!

  • @dasrotrad
    @dasrotrad Před 2 lety +1

    Another great video. Thank you Pat.

    • @Riffomonas
      @Riffomonas  Před 2 lety

      Glad you all are enjoying this series 😍 thanks for watching!

  • @dgoodall6468
    @dgoodall6468 Před 2 lety +2

    Thanks for another great video!

    • @Riffomonas
      @Riffomonas  Před 2 lety

      My pleasure - thanks for tuning in! 🤩

  • @caseyj1144
    @caseyj1144 Před 2 lety +2

    I’ve only ever used base r but I want to learn tidyverse so I’m looking forward to the transition videos!

  • @julioramos4113
    @julioramos4113 Před rokem

    this video is great

  • @xxXXCarbon6XXxx
    @xxXXCarbon6XXxx Před 2 lety +1

    Great! I thought of tibbles as dataframes, but with a cuter name. Now I see they are better when wanting to inspect them. Thanks

    • @Riffomonas
      @Riffomonas  Před 2 lety

      Wonderful - thanks for watching! ☺️

  • @javierhernando5063
    @javierhernando5063 Před 2 lety +2

    Great video! Really helpful. I've been waiting for stuff like this long time. My problems usually come from tibble format with base syntax e. g.
    t.test(x=subset(dat, group== "A")[,v[4]], y=subset(dat, group== "B")[,v[4]], paired = F)$p.value I would like to mix all the elements

    • @Riffomonas
      @Riffomonas  Před 2 lety

      Lol I think you might be happier sticking with $ and using the data argument 😊

  • @mikep8857
    @mikep8857 Před 2 lety +2

    Great video. I didn't know that you can bind a vector and a data frame using cbind. I tend to use bind_cols from the tidyverse which is less forgiving.

    • @Riffomonas
      @Riffomonas  Před 2 lety

      I hear you on the “less forgiving” part but I think tidyverse has a lot of that stuff to protect us from doing silly things we aren’t anticipating 🙃

    • @mikep8857
      @mikep8857 Před 2 lety

      @@Riffomonas I agree but it's good to know that you can use cbind to avoid converting your vector into a tibble first.

  • @RUJedi
    @RUJedi Před 2 lety +1

    Tibbles drive me nuts since I'd rather see more of the columns than it fits in the console, so I stick to data frames most of the time.

    • @Riffomonas
      @Riffomonas  Před 2 lety

      Have you tried using the width argument with print to get more columns?

    • @RUJedi
      @RUJedi Před 2 lety

      Didn't know that was an option but I'll check it out. Thanks.

  • @ahmad3823
    @ahmad3823 Před rokem

    y r u in a rush???

  • @monzerthejoker343
    @monzerthejoker343 Před měsícem

    I didn't understand any thing

    • @Riffomonas
      @Riffomonas  Před měsícem

      Sorry! If there's anything specific let me know what was confusing