flippedHistogram: Plot a flipped histogram with a fill value

Description Usage Arguments Value See Also Examples

Description

Plot a flipped histogram with fill values.

Often times, you want to plot a histogram showing patent documents faceted by one value and filled by another.

Usage

1
2
flippedHistogram(df, xVal, fillVal, colors = patentr::scoreColors,
  recolor = FALSE)

Arguments

df

The original data frame of patent data

xVal

A character value of a name in df

fillVal

A character value of a name in df to color the chart.

colors

A character vector of colors, the same length as the number of unique values in the column of xVal[,fillVal]. Default set to scoreColors.

recolor

A logical allowing you to choose to recolor the plot if the colors vector is not applicable to you. Default set to FALSE. Uses the helper function makeColors to generate colors. Note that your plot may fail if colors is not the same length as the number of unique values in fillVal and recolor is set to FALSE.

Value

A plot

See Also

makeColors, capWord

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
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)
flippedHistogram(sumo, "assigneeSmall","score",colors=scoreColors)
flippedHistogram(subset(sumo, score > 0), "assigneeSmall","score",colors=scoreColors)
flippedHistogram(subset(sumo, score > 2) ,"score","assigneeSmall",colors=scoreColors,
recolor = TRUE)
flippedHistogram(subset(sumo, score > 2) ,"assigneeSmall","docType",colors=scoreColors,
recolor = TRUE)

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