spcChart: Statistical Process Control np- or p-Chart Using ggplot2

Description Usage Arguments Value Examples

View source: R/spcChart.R

Description

Function to create statistical process control (SPC) np-chart or p-chart from aviation safety datasets. Uses qcc:qcc() to generate SPC chart values and ggplot2 to generate the plot.

Usage

1
2
3
spcChart(filename, title = NA, type = c("np", "p"), group = c("monthly",
  "quarterly"), enddate = floor_date(today(), "month") - 1,
  startdate = enddate - months(24) + 1)

Arguments

filename

Name of CSV file on working directory to be consumed; expects specific formatting: First column contains dates in the format "Mmm, YYYY" Second column contains a count of events/issues/deficiencies Third column contains the number of relevant operations (i.e. flights) There should be no skipped months within dataset Ordered from oldest date first (top) to newest date last (bottom)

title

Optional plot title

type

Chart type; accepts np or p, default np

group

Date grouping for data to be plotted; accepts monthly or quarterly, default monthly

enddate

Ending date ; accepts lubridate functions, default last day of previous month from current date

startdate

Starting date for data to be plotted; accepts lubridate functions, default first day 24 months before current date

Value

SPC np-chart

Examples

1
2
spcChart("data.csv")
ggplot2::ggsave(filename = "np-Chart.png", plot = spcChart(filename = "file.csv"), device = "png", path = getwd(), height = 7, width = 14, units = "in")

peconeto/safetydata documentation built on May 24, 2019, 6:14 a.m.