ms_funnelchart: Funnel chart object

View source: R/ms_funnelchart.R

ms_funnelchartR Documentation

Funnel chart object

Description

Creation of a funnel chart object that can be inserted in a 'Microsoft' document. Funnel charts use the chartEx pipeline (Office 2016+); older versions of 'Microsoft Office' will display a fallback placeholder.

Each row is one stage of the funnel. Values are typically decreasing (e.g. visitors -> leads -> customers). Bars are centered horizontally and width is proportional to the value.

Usage

ms_funnelchart(data, x, y)

Arguments

data

a data.frame.

x

category column name (stage label).

y

numeric value column name.

Value

An ms_chart object (subclass ms_funnelchart).

See Also

chart_labels()

Other 'Office' chart objects: ms_areachart(), ms_barchart(), ms_boxplotchart(), ms_bubblechart(), ms_chart_combine(), ms_histogramchart(), ms_linechart(), ms_paretochart(), ms_piechart(), ms_radarchart(), ms_scatterchart(), ms_stockchart(), ms_sunburstchart(), ms_treemapchart(), ms_waterfallchart()

Examples

library(officer)

dat <- data.frame(
  stage = c("Visitors", "Leads", "Opportunities", "Quotes", "Customers"),
  count = c(5000, 4000, 3000, 1000, 250),
  stringsAsFactors = FALSE
)
fn <- ms_funnelchart(data = dat, x = "stage", y = "count")

doc <- read_pptx()
doc <- add_slide(doc)
doc <- ph_with(doc, fn, location = ph_location_fullsize())
print(doc, target = tempfile(fileext = ".pptx"))

mschart documentation built on May 17, 2026, 1:09 a.m.