Skip to content

ardata-fr/mschart

Repository files navigation

mschart R package

Build Status

The mschart package provides a framework for easily create charts for 'Microsoft PowerPoint' documents. It has to be used with package officer that will produce the charts in new or existing PowerPoint or Word documents.

Installation

You can install the package from github with:

# install.packages("devtools")
devtools::install_github("ardata-fr/mschart")

Example

This is a basic example which shows you how to create a line chart.

library(mschart)
library(officer)

linec <- ms_linechart(data = iris, x = "Sepal.Length",
                      y = "Sepal.Width", group = "Species")
linec <- chart_ax_y(linec, num_fmt = "0.00", rotation = -90)

Then use package officer to send the object as a chart.

doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_chart(doc, value = linec)

print(doc, target = "example.pptx")