[This article was first published on Methods – finnstats, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Funnel Chart in R, A funnel chart is mainly used for demonstrates the flow of users through a business or sales process. This chart takes its name from its shape, which starts from a broad head and ends in a small neck.

The number of users at each stage of the process are represented from the funnel’s width as it narrows.

Based on the funnel chart can understand easily there are any significant drop-offs and can make decisions accordingly. Note the drop reasons we need to analyze it separately to get the clarity.

So basically funnel charts are high level visualization before going to deeper and deeper investigations.

QQ-plots in R: Quantile-Quantile Plots-Quick Start Guide »

In this article we are going to describe how to create a funnel chart in R, that is interactive.

If you are not installed highcharter package install the same based on below command.

Funnel Chart in R

install.packages(“highcharter”)

Load required R packages, here we are using dplyr and highcharter.

Error Bar Plot in R-Adding Error Bars-Quick Guide »

library(dplyr)
library(highcharter)

Once you loaded the package then need to set the high charter options.

options(highcharter.theme = hc_theme_smpl(tooltip = list(valueDecimals = 2)))

Let’s create a data frame for plotting

df <- data.frame(
x = c(0, 1, 2, 3, 4),
y = c(975, 779, 584, 390, 200),
name = as.factor(c("Leads", "Sales Call", "Follow Up", "Conversion", "Sale"))
) %>%
arrange(-y)

Here we are talking about sales process in different stages like, leads, sales call, follow up, conversion and sales.

df
x   y       name
1 0 975      Leads
2 1 779 Sales Call
3 2 584  Follow Up
4 3 390 Conversion
5 4 200       Sale

Let’s create an interactive funnel chart in R

hc <- df %>%
hchart(
"funnel", hcaes(x = name, y = y),
name = "Sales Conversions"
)
hc

Note displayed normal png image, If you want to see the magic interactive lets plot it.

Animated Graph GIF with gganimate & ggplot »