if(interactive()){
plot(mtcars$mpg, mtcars$disp)
toffice(filename = file.path(tempdir(), "mtcars.pptx"), format = "pptx")
## use ggplot2
ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) + geom_point()
toffice(filename = file.path(tempdir(), "mtcars.pptx"),format = "pptx")
}
Run the code above in your browser using DataLab