janitor

my favourite things about R

I am prepping a talk for R-Ladies Sydney about my favourite R things, the packages and functions that end up in every script I write.

cleaning penguins with the janitor package

The janitor package by Sam Firke contains probably my FAVOURITE R function: clean_names(). By default when I am reading data into R, I pipe clean_names() onto the end of my read_csv(). I never have to look at inconsistently formatted variable names. But janitor package includes lots of other useful functions that make it easier to deal with dirty data and count stuff. new_df <- read_csv(here("data", "df.csv") %>% clean_names()) Exploring package functions Are you keen to dig into the little known functions of a package that you use all the time?

counting things

Series: IDHTG

Sometimes things that are really easy to do in excel are not so intuitive in R. Like counting things. Because most of the time I am working with data in long format, you can end up with hundreds of observations, so functions like length() aren’t useful. Today I just wanted to check how many participants were in this dataset and it took me some significant googling. load packages library(tidyverse) library(ggbeeswarm) library(janitor) create a little df df <- data.