Reshaping with pivots and combining tables with joins in R; Learn R Video 14

Published: 20 February 2024
on channel: DesignCodeDebugRepeat
50
1

o you want to learn to program in R? If you're a beginner, you're in the right place! This is the fourteenth video in an introductory series that will teach you to program and analyze data in R. This series of videos is suitable for beginners or experienced programmers or data analysts who want to learn R. In this video we learn about reshaping data with pivot_longer and pivot_wider, as well as how to easily get better column names, how to figure out which columns are different in different tables, and how to combine tables. Let's have fun learning to program with R!

The auto-graded exercises that go with this video can be downloaded here:
https://github.com/ProfessorBurke/REx...
(Read the readme file and then download or fork the Video14-reshape folder to use in RStudio.)

Do you want a great book to go along with these videos? You might find it helpful to read chapters 11 and 12 (Reshaping Data and Joining Tables in case the chapters have moved) in Introduction to Data Science: Data Analysis and Prediction Algorithms with R by Rafael A. Irizarry:
http://rafalab.dfci.harvard.edu/dsboo...

Coming from a programming background, one of the most helpful R books that I've read is The art of R programming: A tour of statistical software design, by Norman Matloff*:
https://amzn.to/3YCsQZD

And of course, the ultimate source on the Tidyverse itself is Hadley Wickham! I urge you to read his book:
https://r4ds.hadley.nz/

The first R video is here:
   • R Basics: Math, Vectors, Variables, a...  

The introduction to R playlist is here:
   • R Basics: Math, Vectors, Variables, a...  

The first Tidyverse video is here:
   • Introduction to the tidyverse in R (f...  

The video in which I used merge (equivalent to left_join) is here:
   • Visualizing the U.S. Senate compositi...  

Download and install R:
https://www.r-project.org/

Download and install RStudio:
https://posit.co/downloads/

Hadley Wickham's R style guide:
http://adv-r.had.co.nz/Style.html

Here's the data wrangling cheat sheet:
https://www.rstudio.com/wp-content/up...

Here is the data from the video.
AI expenditures from 2017 to 2021, by category, from
https://ourworldindata.org/artificial...
Daniel Zhang, Nestor Maslej, Erik Brynjolfsson, John Etchemendy, Terah Lyons,
James Manyika, Helen Ngo, Juan Carlos Niebles, Michael Sellitto, Ellie Sakhaee,
Yoav Shoham, Jack Clark, and Raymond Perrault, “The AI Index 2022 Annual
Report,” AI Index Steering Committee, Stanford Institute for Human-Centered AI,
Stanford University, March 2022.

World Happiness Report
https://www.kaggle.com/datasets/unsds...

The github repository with all of the code examples for the introductory programming in R videos is here:
https://github.com/ProfessorBurke/REx...

*As an Amazon Associate I earn from qualifying purchases. Your purchases help me continue to bring you content!

00:00 Welcome!
00:31 pivot_longer
05:45 pivot_wider
07:04 intersect
08:24 clean_names
10:53 join


Watch video Reshaping with pivots and combining tables with joins in R; Learn R Video 14 online without registration, duration hours minute second in high quality. This video was added by user DesignCodeDebugRepeat 20 February 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 5 once and liked it people.