Learn R Programming

insurancerating (version 0.5.2)

autoplot.univ_freq: Automatically create a ggplot for objects obtained from univariate_frequency()

Description

Takes an object produced by univariate_frequency(), and plots the claim frequency.

Usage

# S3 method for univ_freq
autoplot(
  x,
  background = TRUE,
  labels = TRUE,
  sort = FALSE,
  dec.mark = ",",
  color = "dodgerblue",
  color_bg = "#E7B800"
)

Arguments

x

univ_freq object produced by univariate_frequency()

background

show exposure as a histogram (default is TRUE)

labels

show labels with the exposure (default is TRUE)

sort

sort (or order) risk factor into descending order by exposure (default is FALSE)

dec.mark

control the format of the decimal point, as well as the mark between intervals before the decimal point, choose either "," (default) or "."

color

change the color of the points and line ("dodgerblue" is default)

color_bg

change the color of the histogram ("#E7B800" is default)

Value

a ggplot2 object

Examples

Run this code
# NOT RUN {
library(ggplot2)
x <- univariate_frequency(MTPL2, x = area, nclaims = nclaims, exposure = exposure)
autoplot(x)
autoplot(x, sort = TRUE, dec.mark = ".", color_bg = "mediumseagreen")

# }

Run the code above in your browser using DataLab