PPT.AddGraphicstoSlide: Adds an R graphics output to the current slide of current...

Description Usage Arguments Value Warning Author(s) References See Also Examples

Description

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

Usage

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

Arguments

ppt

List of COM objects 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 a list of COM objects.

Warning

You must save the returned list of COM objects initialised with PPT.Init to an R object. See the example.

Author(s)

Wayne Jones [email protected]

References

See http://sunsite.univie.ac.at/rcom for more details on rcom and http://www.omegahat.org/RDCOMClient/ for more details on RDCOMClient.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## 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) 

R2PPT documentation built on May 30, 2017, 7:32 a.m.