PPT.AddGraphicstoSlide {R2PPT}R Documentation

Adds an R graphics output to the current slide of current PowerPoint presentation

Description

Adds an R graphics output to the current slide of the PowerPoint presentation using the AddPicture Method. Graphics output can either be a graphical output file or the current R graphics device as specified by dev.cur.

Usage

PPT.AddGraphicstoSlide(ppt, file = NULL, size = c(10, 10, 700, 500), dev.out.type = "jpeg")

Arguments

ppt Required list of objects of class 'COMobject' as initialised by PPT.Init. See example.
file Optional filename giving the full file path to R graphics output. See example.
size Optional numeric vector of size 4 (Left,Top,Width,Height) giving the dimensions of the R graphics in the PowerPoint slide. Defaults to c(10, 10, 700, 500) which covers most of the slide.
dev.out.type Optional character type of output to use when using current graphics device. Defaults to "jpeg". Ignored if file is specified.

Value

ppt Invisibly returns an updated list of objects of class 'COMobject'.

Warning

You must update the list of ComObjects initialised with PPT.Init when you call this function. The full filepath to a graphics file must be specified. Make sure you have added at least one slide to the presentation before adding a graphic. See the example.

Author(s)

Wayne Jones wayne_betws@hotmail.com

References

See http://sunsite.univie.ac.at/rcom for more details on rcom.

See Also

PPT.Init,PPT.AddTitleSlide,PPT.AddTextSlide,PPT.AddTitleOnlySlide,PPT.Present,PPT.ApplyTemplate,PPT.AddGraphicstoSlide,savePlot

Examples


## Not run: 
myPres<-PPT.Init(visible=TRUE)
myPres<-PPT.AddTitleSlide(myPres,title="How to add R graphics to PowerPoint!")

## Example adding graphic from file
myPres<-PPT.AddBlankSlide(myPres)
jpeg(file="testRplot1.jpeg",quality=100,height=960,width=960)
plot(rnorm(100))
dev.off()
# You must give full file path
myPres<-PPT.AddGraphicstoSlide(myPres,file=paste(getwd(),"testRplot1.jpeg",sep="/"))
unlink(paste(getwd(),"testRplot1.jpeg",sep="/"))
## Example adding graphic from current graphics device
myPres<-PPT.AddBlankSlide(myPres)
hist(rnorm(100))
myPres<-PPT.AddGraphicstoSlide(myPres,size= c(10, 10, 300, 500))
hist(runif(100))
myPres<-PPT.AddGraphicstoSlide(myPres,size= c(350, 10, 300, 500))

## End(Not run) 


[Package R2PPT version 1.0 Index]