# Expanding binomial counts to binary 0/1 with purrr::pmap()

In this post I show how binomial count data can be expanded to long form binary 0/1 data. I've used this approach for simulations to explore methods for diagnosing lack of fit due to non-independence of trials in a binomial vs binary analysis.

# More exploratory plots with ggplot2 and purrr: Adding conditional elements

Following up on a previous post, I show how I add conditional elements to automated ggplot2 plots through the use of if() statements within my plotting function.

# Many similar models - Part 2: Automate model fitting with purrr::map() loops

The task of fitting many similar models can be automated by looping through variables. I show an example of fitting the same model for multiple different response variables and then making residual plots for all models prior to extracting model results.

# Embedding subplots in ggplot2 graphics

I first learned about embedding many small subplots into a larger plot as a way to visualize large datasets with package ggsubplot. Embedding subplots is still possible in ggplot2 today with the annotation_custom() function. I demonstrate one approach to do this, making many subplots in a loop and then adding them to the larger plot.

# Automating exploratory plots with ggplot2 and purrr

In this post I show an example of how to automate the process of making many exploratory plots in ggplot2 with multiple continuous response and explanatory variables. To loop through both x and y variables involves nested looping. In the latter section of the post I go over options for saving the resulting plots, either together in a single document, separately, or by creating combined plots prior to saving.

# A closer look at replicate() and purrr::map() for simulations

In this post I delve into the details of the R functions I've been using in my simulation examples, focusing on the replicate() function and the map family of functions from the purrr package. I spend a little time showing the parallels between the replicate() function and a for() loop.

# Making many added variable plots with purrr and ggplot2

In this post I show one approach for making added variable plots from a model with many continuous explanatory variables. Since this is done for every variable in the model, I show how to automate the process via functions from package purrr.

#### Ariel Muldoon

I currently work as a consulting statistician, advising natural and social science researchers on statistics, statistical programming, and study design. I create and teach R workshops for applied science graduate students who are just getting started in R, where my goal is to make their transition to a programming language as smooth as possible. See my workshop materials at my website.