summaryText: Add summary text to be used in a pptx slide

Description Usage Arguments Value Examples

View source: R/reportPatentData.R

Description

Add a standard summarized text that will be used in association with a plot.

Usage

1
summaryText(df, singular, plural, sumVar)

Arguments

df

A summarized patent data frame, summarized by one variable. See summarizeColumns.

singular

The name of the variable, singular version. A character string. For example: assignee.

plural

The name of the variable, plural version. A character string. For example: assignees, with an 's'.

sumVar

The vector of the variable to summarize, taken from the original patent data set. For example sumo$score to summarize the score range.

Value

A length four character vector.

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
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]
feature1 <- c("adaptive", "park", "lane", NA,NA,NA,NA,NA, 
"brake", "steer","accelerate","deactivate")
f <- round(rnorm(dim(sumo)[1],mean=5,sd=1))
l <- length(feature1)
f[f>l] <- l; f[f<1] <- 1
sumo$feature1 <- c(feature1,feature1[f])[1:dim(sumo)[1]]

# Summarize the assignees
as <- summarizeColumns(sumo, 'assigneeSmall')
summaryText(as, 'assignee','assignees',sumo$score)
# summarize the number of features
f <- summarizeColumns(sumo, 'feature1', naOmit = TRUE)
summaryText(f, 'feature','features',sumo$feature1)

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