paint-brush
How to Create A Funnel Chart In Rby@finnstats
846 reads
846 reads

How to Create A Funnel Chart In R

by finnstatsJune 23rd, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A funnel chart is mainly used for demonstrates the flow of users through a business or sales process. The number of users at each stage of the process are represented from the funnel’s width as it narrows. This chart takes its name from its shape, which starts from a broad head and ends in a small neck. In this article we are going to describe how to create an interactive funnel chart in R, that is interactive. The chart is high level visualization before going to deeper and deeper investigations.

Coin Mentioned

Mention Thumbnail
featured image - How to Create A  Funnel Chart In R
finnstats HackerNoon profile picture

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 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.

In this article we are going to describe how to create 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.

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 magics of interactive let's plot it.

Previously published at https://finnstats.com/index.php/category/data-analysis-in-r/