5 useful R tips from rstudio::conf(2020) - tidy eval, piping, conflicts, bar charts and colors

Last week I had the pleasure of attending rstudio::conf(2020) in San Francisco. Throughout the course of the week I met many wonderful people and learnt many things. This post covers some of the little tips and tricks that I learnt throughout the conference.

Rebecca Barter

Tip 1: Tidy evaluation Tip 2: Pipe into later arguments of a function using . Tip 3: Function conflicts workaround (no more dplyr::select()) Tip 4: geom_col(): you’ll never have to specify “stat = identity” for your bar plots ever again! Tip 5: Using show_col() for viewing colour palettes This was my second year attending rstudio::conf() as a diversity scholar (and my first time as a speaker), and I was yet again blown away by the friendliness of the community and the quality of the talks.

Learn to purrr

Purrr is the tidyverse's answer to apply functions for iteration. It's one of those packages that you might have heard of, but seemed too complicated to sit down and learn. Starting with map functions, and taking you on a journey that will harness the power of the list, this post will have you purrring in no time.

Rebecca Barter

Map functions: beyond apply Simplest usage: repeated looping with map The tilde-dot shorthand for functions Applying map functions in a slightly more interesting context Maps with multiple input objects List columns and Nested data frames Nesting the gapminder data Advanced exercise Additional purrr functionalities for lists Keep/Discard: select_if for lists Reduce Logical statements for lists Answer to advanced exercise “It was on the corner of the street that he noticed the first sign of something peculiar - a cat reading a map” - J.

Rebecca Barter

Data shaping: tidyr Gathering and spreading Combining and separating variables Replacing loops: purrr Loading data: readr Storing data: tibbles Dates, factors and strings: lubridate, forcats and stringr Handling dates and times: lubridate Handling factors: forcats Handling strings: stringr If you’re new to the tidyverse, I recommend that you first read part one of this two-part series on transitioning into the tidyverse. Part 1 focuses on what I feel are the most important aspects and packages of the tidyverse: tidy thinking, piping, dplyr and ggplot2.