make_average_graph: Create a line graph with 95% confidence interval bars

Description Usage Arguments Value Examples

View source: R/graphs.R

Description

Create a line graph with 95% confidence interval bars

Usage

1
2
3
4
5
6
7
8
make_average_graph(
  data,
  x_col,
  y_col,
  confidence_interval_error_bars = TRUE,
  mean_line = TRUE,
  type = c("line", "bar")
)

Arguments

data

A data.frame with the data you want to graph

x_col

A string with the name of the x-axis column

y_col

A string with the name of the y-axis column

confidence_interval_error_bars

A boolean (default TRUE) for whether to include 95% confidence intervals or not.

mean_line

If TRUE (default) willadd a dashed line with the overall mean.

type

A string for whether it should make a linegraph ("line", default) or a bargraph ("bar")

Value

A ggplot object. Also prints the graph to the Plots panel.

Examples

1
2
3
4
5
6
data = data.frame(x = sample(15:25, size = 200, replace = TRUE),
y = sample(1:100, size = 200, replace = TRUE))
make_average_graph(data, "x", "y")
make_average_graph(data, "x", "y", confidence_interval_error_bars  = FALSE)
make_average_graph(data, "x", "y", type = "bar", mean_line = FALSE)
make_average_graph(data, "x", "y", confidence_interval_error_bars  = FALSE, type = "bar")

crimeutils documentation built on Feb. 3, 2021, 5:07 p.m.