Create a frequency histogram for codes
Arguments
- x
A parsed source(s) object.
- codes
A regular expression to select codes to include.
- sortByFreq
Whether to sort by frequency decreasingly (
decreasing, the default), increasingly (increasing), or alphabetically (NULL).- forceRootStripping
Force the stripping of roots, even if they are different.
- trimSourceIdentifiers
If not
NULL, the number of character to trim the source identifiers to.- ggplot2Theme
Can be used to specify theme elements for the plot.
- silent
Whether to be chatty or silent.
Examples
### 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
rock::code_freq_hist(loadedExample);
### - - - - - - - - - - - - - - - - - - - - - - -
### Multiple sources
### - - - - - - - - - - - - - - - - - - - - - - -
### Load example source
loadedExamples <- rock::parse_sources(
examplePath,
regex = "example-[1234]"
);
#> Warning: For instance '1' of class 'caseId', attribute 'age' has different values: '60s' & '50s'. Taking the first element: '60s'.
#> Warning: For instance '2' of class 'caseId', attribute 'age' has different values: '20s' & '30s'. Taking the first element: '20s'.
#> Warning: For instance '1' of class 'caseId', attribute 'age' has different values: '60s' & '50s'. Taking the first element: '60s'.
#> Warning: For instance '2' of class 'caseId', attribute 'age' has different values: '20s' & '30s'. Taking the first element: '20s'.
#> Warning: For instance '1' of class 'caseId', attribute 'age' has different values: '60s' & '50s'. Taking the first element: '60s'.
#> Warning: For instance '2' of class 'caseId', attribute 'age' has different values: '20s' & '30s'. Taking the first element: '20s'.
### Show code frequencies
rock::code_freq_hist(loadedExamples);
