In my Going Deeper with R course ( https://rforthe.rest/deeper ) I post links to resources to help people learn more on topics. Here are some in the data wrangling and analysis section. #rstats
If you want to learn about tidy data, the vignette on that topic is the place to go. https://tidyr.tidyverse.org/articles/tidy-data.html
Learning to use the newish pivot_longer() and pivot_longer() functions to reshape your data? Check out the pivoting vignette. https://tidyr.tidyverse.org/articles/pivot.html
There's also a nice article by @ucfagls here about learning to use the pivot_ functions to tidy your data. https://fromthebottomoftheheap.net/2019/10/25/pivoting-tidily/
This article includes animations of pivoting made by @grrrck and @datandme which are really helpful!
Also check out the RStudio Cloud primer on tidying data, which even has some exercises to help you learn more.
https://rstudio.cloud/learn/primers/4.1
https://rstudio.cloud/learn/primers/4.1
There's also a nice article by @ucfagls here about learning to use the pivot_ functions to tidy your data. https://fromthebottomoftheheap.net/2019/10/25/pivoting-tidily/
case_when() helps you to create new variables depending on conditions in other variables. Think: make the fruit variable "Yes" if name_of_food is strawberry or apple.
@hrbrmstr has a nice article giving an overview of the benefits of case_when() https://rud.is/b/2017/03/10/making-a-case-for-case_when/
@hrbrmstr has a nice article giving an overview of the benefits of case_when() https://rud.is/b/2017/03/10/making-a-case-for-case_when/
If you prefer video, @sharon000 has a nice video overview of case_when()
I pretty much only ever use case_when(). For some reason, it just works better for my mind than anything else.
Apparently, I'm not alone, as this post from @mattdray shows. https://lapsedgeographer.london/2020-04/case_when/
Apparently, I'm not alone, as this post from @mattdray shows. https://lapsedgeographer.london/2020-04/case_when/
When you do anything with group_by() you can't forget to ungroup() afterwards.
Handy picture from @allison_horst to help us all remember!
Handy picture from @allison_horst to help us all remember!
Learning to write your own functions can improve your efficiency. I wrote a blog post last year to help folks get started. https://rfortherestofus.com/2019/10/how-to-make-functions-in-r/
Want to go deeper on making your own functions? Check out Chapter 19 of R for Data Science. https://r4ds.had.co.nz/functions.html
Stat545 also has a nice section on creating functions. https://stat545.com/functions-part1.html
This lesson from @kellybodwin will also help you write better functions.
https://cal-poly-advanced-r.github.io/STAT-431/Canvas_Pages/Week_4-Packages/Writing_Functions.html
https://cal-poly-advanced-r.github.io/STAT-431/Canvas_Pages/Week_4-Packages/Writing_Functions.html
When you're learning about merging data, the best place for visual learners to go is the {tidyexplain} package by @grrrck.
With animations like this, it makes it easy to make sense of the various joins in dplyr.
With animations like this, it makes it easy to make sense of the various joins in dplyr.