View source: R/ms_histogramchart.R
| ms_histogramchart | R Documentation |
Creation of a histogram chart object that can be inserted in a 'Microsoft' document. Histogram charts use the chartEx pipeline (Office 2016+); older versions of 'Microsoft Office' will display a fallback placeholder.
Data is a single column of raw numeric observations. Office computes
the bins automatically; pass bin_count or bin_width to override.
ms_histogramchart(
data,
value,
bin_count = NULL,
bin_width = NULL,
interval_closed = c("right", "left"),
underflow = NULL,
overflow = NULL
)
data |
a data.frame. |
value |
numeric column name (raw observations). |
bin_count |
integer, requested number of bins. Mutually exclusive
with |
bin_width |
numeric, requested bin width. Mutually exclusive with
|
interval_closed |
one of |
underflow |
numeric, values below this go in an "underflow" bin. NULL to disable. |
overflow |
numeric, values above this go in an "overflow" bin. NULL to disable. |
An ms_chart object (subclass ms_histogramchart).
chart_labels()
Other 'Office' chart objects:
ms_areachart(),
ms_barchart(),
ms_boxplotchart(),
ms_bubblechart(),
ms_chart_combine(),
ms_funnelchart(),
ms_linechart(),
ms_paretochart(),
ms_piechart(),
ms_radarchart(),
ms_scatterchart(),
ms_stockchart(),
ms_sunburstchart(),
ms_treemapchart(),
ms_waterfallchart()
library(officer)
set.seed(1)
dat <- data.frame(x = rnorm(200, mean = 10, sd = 4))
hi <- ms_histogramchart(dat, value = "x", bin_count = 12)
doc <- read_pptx()
doc <- add_slide(doc)
doc <- ph_with(doc, hi, 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.