dplyr: gather and spread

preview_player
Показать описание
The gather function in dplyr lets you turn wide data into a long format, while the spread function lets to turn long data into a wide format. Data in R generally likes to be in a long format, so knowing how to gather messy data into a tall format if necessary is an important part of the data cleaning process.

Link to the Kaggle Notebook code used for this video series:

View the whole dplyr in R playlist here:

dplyr cheat sheet from RStudio:

dplyr documentation:

Follow DataDaft on social media for news and updates:

Join the DataDaft Discord to discuss all things data science:

#dplyr #rprogramming #datascience
Рекомендации по теме
Комментарии
Автор

thank you! I was struggling with gather
until this video.

silfalqueto
Автор

Hello from Brazil, thanks for the video!

jhonataoliveira
Автор

Aren't these tidyr functions? Newer versions, probably more intuitive, are called pivot_longer() and pivot_wider().
It is nice though how well the tidyverse packages (like dplyr, tidyr, ggplot2, stringr, readr, and others) work together.

StatistikinDD
Автор

The gather()/pivot_longer() and spread()/pivot_wider() are from {tidyr} package, not dplyr.

aephidayatuloh
Автор

Your missing a link to the next video in your playlist here!

sbdavid
Автор

When i use the spread function, some of my column repeat its values and causes some values in the new column to be NA. How do i fix this?

yobruh
Автор

Is this now called pivot_longer() and pivot_wider()

epistemicompute