Factory function to control ggplot2::geom_xxx functions

get_geom_function(geom, allowed = c("line", "bar", "point"))

Arguments

geom

string representation of ggplot2::geom_xxx function

allowed

character vector contains allowed values

Value

function

Examples

ggfortify:::get_geom_function('point')
#> function (mapping = NULL, data = NULL, stat = "identity", position = "identity", 
#>     ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) 
#> {
#>     layer(data = data, mapping = mapping, stat = stat, geom = GeomPoint, 
#>         position = position, show.legend = show.legend, inherit.aes = inherit.aes, 
#>         params = list2(na.rm = na.rm, ...))
#> }
#> <bytecode: 0x555d791968a8>
#> <environment: namespace:ggplot2>
ggfortify:::get_geom_function('line', allowed = c('line'))
#> function (mapping = NULL, data = NULL, stat = "identity", position = "identity", 
#>     na.rm = FALSE, orientation = NA, show.legend = NA, inherit.aes = TRUE, 
#>     ...) 
#> {
#>     layer(data = data, mapping = mapping, stat = stat, geom = GeomLine, 
#>         position = position, show.legend = show.legend, inherit.aes = inherit.aes, 
#>         params = list2(na.rm = na.rm, orientation = orientation, 
#>             ...))
#> }
#> <bytecode: 0x555d7ae8bd08>
#> <environment: namespace:ggplot2>