In this tutorial, I'll show how to use R to quantitatively explore, analyze, and visualize a research literature, using Psychonomic Society publications. This post directly continues from [part I of Quantitative literature review with R](https://mvuorre.github.io/post/2017/quantitative-literature-review-with-r-part-i/). Please read that first for context. Part I focused on data cleaning and simple figures, but here we will look at relational data by visualizing some network structures in the data.
In this post, I’ll show how to create GitHub style “waffle” plot in R with the ggplot2 plotting package.
Simulate activity data First, I’ll create a data frame for the simulated data, initializing the data types:
library(dplyr) d <- data_frame( date = as.Date(1:813, origin = "2014-01-01"), year = format(date, "%Y"), week = as.integer(format(date, "%W")) + 1, # Week starts at 1 day = factor(weekdays(date, T), levels = rev(c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"))), hours = 0) And then simulate hours worked for each date.