View source: R/ms_boxplotchart.R
| ms_boxplotchart | R Documentation |
Creation of a box-and-whisker chart object that can be inserted in a 'Microsoft' document. Boxplot charts use the chartEx pipeline (Office 2016+); older versions of 'Microsoft Office' will display a fallback placeholder.
Data is in long format: one row per observation. Office computes quartiles and whiskers from the raw values; do not pre-aggregate.
ms_boxplotchart(
data,
x,
y,
quartile_method = c("exclusive", "inclusive"),
show_mean_marker = TRUE,
show_mean_line = FALSE,
show_outliers = TRUE,
show_inner_points = FALSE
)
data |
a data.frame. |
x |
category column name. Each unique value becomes one box. |
y |
numeric value column name (raw observations). |
quartile_method |
one of |
show_mean_marker |
logical, draw the mean as a marker. Default TRUE. |
show_mean_line |
logical, draw a line connecting means across boxes. Default FALSE. |
show_outliers |
logical, plot outlier points. Default TRUE. |
show_inner_points |
logical, plot all non-outlier points. Default FALSE. |
An ms_chart object (subclass ms_boxplotchart).
chart_labels()
Other 'Office' chart objects:
ms_areachart(),
ms_barchart(),
ms_bubblechart(),
ms_chart_combine(),
ms_funnelchart(),
ms_histogramchart(),
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(
group = rep(c("A", "B", "C"), each = 20),
value = c(rnorm(20, 0, 5), rnorm(20, 3, 7), rnorm(20, -2, 4))
)
bp <- ms_boxplotchart(dat, x = "group", y = "value")
doc <- read_pptx()
doc <- add_slide(doc)
doc <- ph_with(doc, bp, 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.