R package ggplotAssist

Keon-Woong Moon

2017-11-12

The 'ggplotAssist' is an RStudio addin for teaching and learning plot generation using the 'ggplot2' package. You can learn each steps of plot generation - aesthetics mapping, select geometries, add scales, apply theme - by clicking your mouse without coding. You can see the resultant plot and see the each steps of plot layer by layer. You get resultant code for ggplot. 

Prerequisite

You have to install the developmental version of R package editData from github.

#install.packages("devtools")
devtools::install_github("cardiomoon/editData")

Install package

You can install ggplotAssist package from github.

#install.packages("devtools")
devtools::install_github("cardiomoon/ggplotAssist")

Usage: As an RStudio Add-in

This addin can be used to interactively generate a ggplot using ggplot2 package. The intended way to use this is as follows:

  1. Highlight a symbol naming a data.frame or a tibble in your R session, e.g. msleep(1). Execute this addin(arrow), to interactively manipulate it.

  1. You can see a brower window. You can see the data name(1) and R code for ggplot(2). Select x(3) and bodywt(4) to map bodywt as a x-axis variable.

  1. When you’re done, the code for the ggplot will be emitted at the cursor position(scarlet rectangle).

Usage: As a regular function

You can use the ggplotAssist() function as a regular function, e.g. in a command line.

result <- ggplotAssist(mtcars)

Full vignette

You can find full vignette here. http://rpubs.com/cardiomoon/321791