View source: R/code_freq_hist.R
code_freq_hist | R Documentation |
Create a frequency histogram for codes
code_freq_hist(
x,
codes = ".*",
sortByFreq = "decreasing",
forceRootStripping = FALSE,
trimSourceIdentifiers = 20,
ggplot2Theme = ggplot2::theme(legend.position = "bottom"),
silent = rock::opts$get("silent")
)
x |
A parsed source(s) object. |
codes |
A regular expression to select codes to include. |
sortByFreq |
Whether to sort by frequency decreasingly
( |
forceRootStripping |
Force the stripping of roots, even if they are different. |
trimSourceIdentifiers |
If not |
ggplot2Theme |
Can be used to specify theme elements for the plot. |
silent |
Whether to be chatty or silent. |
a ggplot2::ggplot()
.
### Get path to example source
examplePath <-
system.file("extdata", package="rock");
### Get a path to one example file
exampleFile <-
file.path(examplePath, "example-1.rock");
### Load example source
loadedExample <- rock::parse_source(exampleFile);
### Show code frequencies
code_freq_hist(loadedExample);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.