🔔 *Subscribe for weekly R videos:* https://www.youtube.com/channel/UCb5aI-GwJm3ZxlwtCsLu78Q?sub_confirmation=1
Here are 18 ways to speed up data cleaning, tidying, and exploration with the tidyverse packages in R. They'll help you to work with data more efficiently, simplify your R code, and surprise your friends!!
🎉 *Enjoyed this video?* Leave a comment below to share what you liked the most!
0:00 Intro
1:04 Create new columns in a count or group_by
2:11 Sample and randomly shuffle data with slice_sample()
3:05 Create a date column specifying year, month, and day
3:25 Parse numbers with parse_number()
4:07 Select columns with starts_with, ends_with, etc.
4:56 case_when to create or change a column when conditions are met
6:36 str_replace_all to find and replace multiple options at once
7:15 Transmute to create or change columns and keep only those columns
7:48 Use pipes everywhere including inside mutates
9:11 Filter groups without making a new column
10:04 Split a string into columns based on a regular expression
11:10 semi_join to pick only rows from the first table which are matched in the second table
12:20 anti_join to pick only rows from the first table which are NOT matched in the second table
12:48 fct_reorder to sort bar charts
14:06 coord_flip to display counts more beautifully
14:32 fct_lump to lump some factor levels into "Other"
15:26 Generate all combinations using crossing
16:00 Create functions that take column names with double curly braces
18:00 The end
Code:
https://gist.github.com/larsentom/727da01476ad1fe5c066a53cc784417b
#rstats #rstudio #datascience #tidyverse