library(officer)
set.seed(1)
dat <- data.frame(
defect = sample(c("A", "B", "C", "D"), 50, replace = TRUE,
prob = c(0.5, 0.25, 0.15, 0.1))
)
pa <- ms_paretochart(dat, x = "defect")
doc <- read_pptx()
doc <- add_slide(doc)
doc <- ph_with(doc, pa, location = ph_location_fullsize())
print(doc, target = tempfile(fileext = ".pptx"))
Run the code above in your browser using DataLab