View source: R/ms_funnelchart.R
| ms_funnelchart | R Documentation |
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.
ms_funnelchart(data, x, y)
data |
a data.frame. |
x |
category column name (stage label). |
y |
numeric value column name. |
An ms_chart object (subclass ms_funnelchart).
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()
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.