library(officer)
dat <- data.frame(
step = c("Start", "Q1", "Q2", "Q3", "End"),
amount = c(100, 30, -20, 40, 150),
stringsAsFactors = FALSE
)
wf <- ms_waterfallchart(
data = dat, x = "step", y = "amount",
subtotals = c(1, 5)
)
doc <- read_pptx()
doc <- add_slide(doc)
doc <- ph_with(doc, wf, location = ph_location_fullsize())
print(doc, target = tempfile(fileext = ".pptx"))
Run the code above in your browser using DataLab