Tableau-like Drag and Drop GUI Visualization in R


One of the the few things that Self-service Data Visualization tools like Tableau and Qlik offer that sophisticated Data Science Languages like R and Python do not offer is — The Drag and Drop GUI to create Visualizations. The flexibility with which you can simply drag and drop your Dimensions and Metrics is so intuitive that a high school kid with no technical experience can build a decent visualization.

If you are an R user and you’ve been envying them, Here is a magical tool — esquisse — that sits right inside your RStudio and helps you build ggplot2 with Drag and Drop GUI. (As a side note, this is so intuitive, a Python user also could do!)

This new R package esquisse is created and open-sourced by the French company DreamRs which has open-sourced multiple useful R packages like this one.

As described in the documentation,

esquisse allows you to interactively explore your data by visualizing it with the ggplot2 package. It allows you to draw bar graphs, curves, scatter plots, histograms, then export the graph or retrieve the code generating the graph.

esquisse is available on CRAN hence can be installed using the following code:

# From CRAN

or you can install the development version that’s hosted on github using any of the following codes.

# with remotes

# or with service (based on remotes)

# or with devtools:

As we have understood from the beginning, this package esquisse helps us in generating a visualization (ggplot2) with just drag and drop and we will we see how to do the same.

To begin with, We will use the R package itunesr to extract some App Reviews (in this case, Indian e-tailer Flipkart’s iOS App) and try to visualize using our Drag and Drop GUI.

#loading tidyverse to read input
# loading itunesr for retrieving itunes review data that we will use in this analysis
#loading the magical esquisse library
# Flipkart Reviews
reviews <- getReviews(742044692,'in',1)
#converting Rating to numeric type
reviews$Rating <- as.numeric(reviews$Rating)
#let us say we want to see if there's any correlation between rating and review length
reviews$len <- nchar(reviews$Review)

The idea above is very simple.

  • We are loading the required packages
  • Fetching data using itunesr
  • Some Data preparation to convert the variable Rating to numeric and calculating Review length in len

With that, we are ready to begin our Drag and Drop journey with the following code.

#let the magic begin

As you can see above, the function esquisser takes the dataframe which we want to visualize as the argument and if nothing is provided, it would consider the dataframes in the current R environment space as options. If there’s no dataframes in the current R environment space, then inbuilt datasets like diamond are provided.

From this point, It’s going to be GUI based actions, hence I’ve created the following video for this post — to explain how can you create the ggplot2 visualization using Drag and Drop GUI and finally copy the R code of the created plot.

The copied code is as follows:

#copied code
ggplot(data = reviews) +
aes(x = len, y = Rating) +
geom_point(color = '#e31a1c') +
labs(title = 'Ratings vs Reviews Length',
x = 'Length of Review',
y = 'Rating associated with Review',
caption = 'Data Source: App Store',
subtitle = 'Flipkart iOS App Reviews') +

Which gives the following plot:

Even though the above plot is nothing fancy, It’s a complete plot which I mean, with right axes labels and details like Title, Subtitle and Caption.

I think this package will definitely save a lot of time and also open up much more possibilities for Analysts during EDA. If you want to create solutions like this, you can learn more from Datacamp’s Building Web Applications in R with Shiny Course. The complete code used here is available on my github.