In my Going Deeper with R course ( https://rforthe.rest/deeper )">https://rforthe.rest/deeper&qu... 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">https://tidyr.tidyverse.org/articles/...
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">https://tidyr.tidyverse.org/articles/...
There& #39;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/">https://fromthebottomoftheheap.net/2019/10/2...
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/pri...
https://rstudio.cloud/learn/primers/4.1">https://rstudio.cloud/learn/pri...
There& #39;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/">https://fromthebottomoftheheap.net/2019/10/2...
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/">https://rud.is/b/2017/03...
@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/">https://rud.is/b/2017/03...
If you prefer video, @sharon000 has a nice video overview of case_when() https://www.youtube.com/watch?v=amiW9H-oOS4">https://www.youtube.com/watch...
I pretty much only ever use case_when(). For some reason, it just works better for my mind than anything else.
Apparently, I& #39;m not alone, as this post from @mattdray shows. https://lapsedgeographer.london/2020-04/case_when/">https://lapsedgeographer.london/2020-04/c...
Apparently, I& #39;m not alone, as this post from @mattdray shows. https://lapsedgeographer.london/2020-04/case_when/">https://lapsedgeographer.london/2020-04/c...
When you do anything with group_by() you can& #39;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/">https://rfortherestofus.com/2019/10/h...
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 ">https://r4ds.had.co.nz/functions...
Stat545 also has a nice section on creating functions. https://stat545.com/functions-part1.html">https://stat545.com/functions...
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/...
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/...