across and summary tables

Thanks to Tom Mock for saving me from this blogpost on twitter. I was monster number 6… beginning to convince myself that there were gremlins in the across() function. In fact, I had forgotten the golden rule: don’t make objects that have the same names a functions That is for another post… the across() function I have been playing with the new across() function in dplyr which is a magical solution when you are looking to get several summary statistics across a range of variables.

my first pull request

There are so many lovely packages for colour palettes (see links at the bottom of this post for more). This new one called feather by Shandiya Balasubramanium is inspired by Australian birds and is delightful. Today I built my first R package! Meet feather: a set of colour palettes inspired by the plumage of Australian birds. It's a work in progress and a bit rough around the edges, but I'm pretty proud of it#RStats #WildOz #DataVisualization https://t.

functions to save you time

Last year my R resolution was to google less. I think I succeeded (kinda). I wrote a few posts in my IDHTG series. counting things recoding variable work with factors annotating plots use colour palettes I don’t necessary remember exactly how to recode variables or to make factors behave, but I know I have notes in my blog about those things to refer to, so that makes the googling much faster.

serious git thinking

I have been a git user for 513 days. When I was first setting up this blog, my dear friend Charles T Gray helped me learn the 3 terminal commands that you need to know to interact with git in the most rudimentary of ways. git add . git commit -m “something meaningful” git push Since then I have mostly just used these 3 commands to push blog posts to git.

insights from the RMarkdown whisperer

I had the pleasure of attending Alison Hill’s RMarkdown workshop in Canberra on Monday and I came away with so many tips and tricks! It was brillant. Alison covered A LOT over the course of the day. I learned lots of the power of yaml, how to create parameterised reports, and how to make a package that contains customised .Rmd templates. Each of those topics are blogposts for another day, but my favourite bit was making a beautiful Academic theme blogdown site.

customise your R experience

Would you like RStudio to show you a random The Good Place quote, spoken by a ASCII animal along with some random message of praise/encouragement each time you start a coding session or restart R? Of course you would!!! how to customise your .rprofile You will need to install the following packages: usethis goodshirt cowsay praise Use usethis to open your .rprofile file usethis::edit_r_profile() Copy and paste this text into your .


Cute #rstats monster art by the amazing Allison Horst. I have been using gather() and spread() a lot lately. I’m on the tidy data train; long data is essential for ggplot etc, but sometimes you want to do calculations row wise, which is kinda complicated. For example, this week Matilda and I were working with her language/locomotion data and we were looking at the number of action-directed, affirmative, and descriptive responses that parents make to their infants.

making memes in R

I having been prepping for my lightning talk at the R-Ladies Sydney Birthday this weekend and learning about all the packages that you can use to make memes in R. I’m going going to talk about my favourite option (which is the memery package), but here is what I learned about other packages. Option 1: memer The memer package by Sam Tyner is a tidyverse compatible package that allows you to replace text in popular memes with your own.

apa figures

As I write my first paper reporting data analysis coming out of R (woot!!!), here are some notes summarising all the googling I have done this morning about how to produce APA style figures in ggplot. via GIPHY Load libraries Start by loading tidyverse to get ggplot, here to make finding the data easy, and papaja to get the theme_apa() function. library(tidyverse) library(here) library(papaja) Read in data plotdata <- read_csv(here("plotdata.


There has been lots of talk about blogdown on #rstats Twitter recently and people have been talking up the Hugo “Academic theme”. I want to give it a go to update my lab website, so thought it might be a good idea to pull together all the useful links I’ve seen recently into one place. Alison Hill I used Alison’s blog post when I first set up this blog.


I think I have broken hugo testing whether this works

rm anova options

I’ve been analysing some future thinking data and playing around with packages that can do repeated ANOVA (I know, I should do LMM). There is more than one way to skin a cat and the differences come down to two things. the intuitiveness of the function arguments the readibility of the output Some checks to do before you start - all of these packages assume that you within and between subjects variables are factors, but also that your participant id is a factor

Just Three Things

I love me a good #rstats screencast. David Robinson has been screencasting his #TidyTuesday efforts for the past few months and while it is GREAT to watch a master at work, I just don’t have time to watch someone code for an hour, in order to extract a handful of tips. So when I saw Nick Tierney tweet about posting short videos that contain Just Three Things, I thought “that is a GREAT idea”.

infinite moon reader

I saw an intriguing tweet this afternoon. 🧙 ♂️Live preview for R Markdown! TIL that you can have a live preview of your #rstats Markdown docs! Just use the infinite_moon_reader function from the xaringan package. It works for all single-HTML-file outputs and even comes with a pre-made RStudio Addin! — Jozef Hajnala (@jozefhajnala) January 2, 2019 When Charles was visiting for #RCurious in June, she had written her slides in xaringan and was raving about infinite moon reader.

how to add a gif

Sometimes your plot needs a celebratory gif. I have just finished the vizwhiz module for #RYouWithMe and to top off the series I worked out how to add an RLady Wizard to our final plot. Just so I’ll remember for next time, here is a step by step how to… how to add a gif to your ggplot Install the magick package and load it with ggplot. Install and load the beepr package too so you can have RStudio beep at you when it has finished rendering your gif (it can take a long time).

how to use the `here` package

I’m still working on getting my head around where R thinks we work and how to tell it where my stuff lives (aka working directories). On twitter yesterday Alison Hill, Adam Gruer, Zoe Meers and Irene Steves helped me sort out my issues with here. hi #rstats friends, how do YOU use the here package? I thought I had my head around it but I'm doing something wrong. Here my markdown lives within the “markdown” folder, so I set here to the “data” folder, call read_csv(here(“datafile.

things i googled this week

How would we learn R if not for google? Here are some things I googled this week (and mostly not for the first time). 1. how to install a package from github. 95% of the time, packages I want are on CRAN and I can just use the install.packages function to install them. install.packages("nameofthepackage") Occasionally though, I see something cool and new on Twitter and need to install from github.

Writing about LMM

Learning new things is HARD. Stats methods are particularly hard because it not just about running the test. You have to… learn when to run the test learn how to run the test learn how to interpret the test AND learn how to write about the results of the test Part of what makes this learning hard is that our research methods training has drummed into us that there is a RIGHT WAY TO DO IT.

let me count the ways

When we want to learn how to do something new in R, we all start by googling it. Having worked out simple ANOVA, next on my list is repeated measures. Domnique Makowski has an excellent blog post that comes up at the top of the search results when you google “how to do repeated measures ANOVA in R”. He lures you in with a post that seems like it is going to solve all your problems and then and BAM… starts the post by saying “DON’T do it”.

where is here?

As I add new projects to my rstats portfolio and work collaboratively on projects with students the issue of working directories is becoming more and more complicated. Not really understanding how working directories and file paths actually work, I have been relying on the beginner logic… Everything will be just fine as long as you keep your datafiles in the same folder as your .rmd file via GIPHY I aspire to have organized folders that Jen Thompson would be proud of, but that is going involve getting my head around directories.

testing out t-tests

I was trying to work out how to do t-tests using my own data and the lsr package but ended up working with Dani’s AFL data from her book while trying to work out why R insisted that my outcome variable wasn’t numeric (it definitely was). Turns out that the lsr package doesn’t deal well with tibbles (which are created by default when you use read_csv to get your data) but if you use read.

Use map to read many csv files

Dipping my toes in purrr here and replicating options from a super useful blog post I found by ClausWilke

I don’t like cats much

I don’t love cats. I am not a member of @RCatLadies. So the fact that Tidyverse packages for dealing with factors and functional programming have cat-related names (forcats and purrr) does not endear them to me. I knew there was a time when I would encounter an R problem that needed the power of for loops, so when I asked the Twittersphere whether there was an alternative (hopefully a tidyverse one) that would allow me to avoid loops a little longer, I was a bit disappointed to hear that it is the purrr package.

lesser known stars of the tidyverse

Emily Robinson has just joined DataCamp and writes a great blog called She talked at the 2018 New York R conference recently and shared some of her favourite (less well known) stars of the Tidyverse. Here are her slides and my notes…

dirty data

I have been doing lots of data wrangling recently and decided a needed a quick rundown of data cleaning in R. Turns out has a course called exactly that. Here are notes on useful things I learned.


There are some commands that as I get more and more familiar with Rstudio I find myself typing again and again.

cooking with datapasta

Another day… another data set. This time I am trying to get EMG data from LabChart into R. LabChart is the software we use to record EMG data and do the first steps of data cleaning/processing. At the moment a good chunk of the cleaning process involves Excel macros, so my goal is to replicate what we have traditionally done in Excel in R, so that it is more automated and more reproducible.

calculating age

I have been playing with a new (not actually new, but new to R) dataset this week. Successes: I loaded the data in using read_csv. *** see ERRATUM below I fixed some weird data type assumptions. The interview group is listed as 1s and 2s in the file so R thought those were integers. So I used as.factor to convert. dataframe$variable <- as.factor(dataframe$variable) I used lubridate package to specify that DOB and Test_date were dates with Day Month Year (dmy) format.

fomo on #useR2018

I have been travelling for the last few weeks, first to a teaching conference at Duke called PsychOne, and then to the International Congress on Infant Studies (ICIS) in Philadelphia. There was a surprising amount of #rstats at ICIS which was awesome. Everyone is talking about reproducible science and preregistration and best practices that will improve our field. There is definitely another blog post needed to consolidate my notes from ICIS, but for now, I want to write about #useR2018 (a conference I didn’t get to go to).


What a treat it was to finally meet Charles Gray when she was in Sydney last week. She ran her R-Curious workshop for us and I picked up so many useful markdown tips. We worked from an Rmarkdown document in the workshop so we could edit the code and add our own notes but we could also how Charles had used specific markdown formatting to produce the document.