addFullImagePptx: Add a full-sized plot image to a pptx

Description Usage Arguments Value See Also Examples

View source: R/reportPatentData.R

Description

Take a plot image from ggplot2 and size it to fit an entire slide.

Usage

1
2
addFullImagePptx(ppt, plot, slide_layout = "Title and Content", w = 13.3,
  h = 7.5)

Arguments

ppt

A ppt object to add a slide to.

plot

A plot output object from ggplto2.

slide_layout

A character value, slide layout, default value is "Title and Content".

w

Width in inches, default set to max width 13.3

h

Height in inches, default set to max height 7.5

Value

a pptx object.

See Also

addChartRightTextLeftPptx

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
sumo <- cleanPatentData(patentData = patentr::acars, columnsExpected = sumobrainColumns,
cleanNames = sumobrainNames,
dateFields = sumobrainDateFields,
dateOrders = sumobrainDateOrder,
deduplicate = TRUE,
cakcDict = patentr::cakcDict,
docLengthTypesDict = patentr::docLengthTypesDict,
keepType = "grant",
firstAssigneeOnly = TRUE,
assigneeSep = ";",
stopWords = patentr::assigneeStopWords)

# note that in reality, you need a patent analyst to carefully score
# these patents, the score here is for demonstrational purposes
score <- round(rnorm(dim(sumo)[1],mean=1.4,sd=0.9))
score[score>3] <- 3; score[score<0] <- 0
sumo$score <- score
sumo$assigneeSmall <- strtrim(sumo$assigneeClean,12)
category <- c("system","control algorithm","product","control system", "communication")
c <- round(rnorm(dim(sumo)[1],mean=2.5,sd=1.5))
c[c>5] <- 5; c[c<1] <- 1
sumo$category <- category[c]

xVal = "category"
fillVal = "score"
facetVal = "assigneeSmall"

fp <- facetPlot(subset(sumo, score > 0), xVal, fillVal, facetVal, colors = patentr::scoreColors,
                recolor = FALSE)



# create a ppt
ppt <- ReporteRs::pptx(title="IP Update")
# view the types of layouts available by default
# slide.layouts(ppt)
layoutTitleContent = "Title and Content"

fp <- facetPlot(subset(sumo, score > 0), xVal, fillVal, facetVal, colors = patentr::scoreColors,
                recolor = FALSE)
ppt <- addFullImagePptx(ppt, plot = fp, slide_layout = layoutTitleContent)
fp <- facetPlot(subset(sumo, score > 1), xVal, fillVal, facetVal, colors = patentr::scoreColors,
                recolor = FALSE)
ppt <- addFullImagePptx(ppt, plot = fp, slide_layout = layoutTitleContent)
fp <- facetPlot(subset(sumo, score > 2), xVal, fillVal, facetVal, colors = patentr::scoreColors,
                recolor = FALSE)
ppt <- addFullImagePptx(ppt, plot = fp, slide_layout = layoutTitleContent)


# find a data folder and write it out to your folder
# out <- paste("data/",Sys.Date(),"_exampleChartRightTextLeft.pptx",sep='')
# ReporteRs::writeDoc(ppt, out)

kamilien1/patentr documentation built on May 20, 2019, 7:19 a.m.