trendline: GLP Trendline

trendlineR Documentation

GLP Trendline

Description

Creates a peer city trendline graph using a GLP-style data frame. Columns FIPS and year are required columns. Columns , sex, and race are optional columns.

Usage

trend(
  df,
  var,
  rollmean = 1,
  xmin = "",
  xmax = "",
  peers = "current",
  cat = "",
  plot_title = "",
  y_title = "",
  caption_text = "",
  subtitle_text = "",
  ylimits = "",
  pctiles = T,
  use_var_type = F,
  shading = F,
  label_function = NULL,
  axis_function = NULL,
  year_breaks = NULL,
  endpoint_labels = TRUE
)

trend_maxmin(
  df,
  var,
  rollmean = 1,
  xmin = "",
  xmax = "",
  peers = "current",
  order = "descending",
  plot_title = "",
  y_title = "",
  caption_text = "",
  subtitle_text = "",
  zero_start = F,
  ylimits = "",
  use_var_type = F,
  label_function = NULL,
  axis_function = NULL,
  year_breaks = NULL,
  endpoint_labels = TRUE,
  max_city = "",
  min_city = ""
)

trend_data(
  df,
  var = "var",
  rollmean = 1,
  xmin = "",
  xmax = "",
  peers = "current",
  cat = "",
  pctiles = T,
  use_var_type = F
)

trend_data_maxmin(
  df,
  var = "var",
  rollmean = 1,
  xmin = "",
  xmax = "",
  peers = "current",
  order = "descending",
  zero_start = F,
  use_var_type = F,
  max_city = "",
  min_city = ""
)

Arguments

df

A data frame

var

The variable name, can be quoted or unquoted

rollmean

A rolling mean. Defaults to 1.

xmin

First year

xmax

Last year

peers

current, baseline, or none.

cat

A character vector that specifies a demographic category. Can be race or sex to display a set of lines for each category, or can be a specific group like white or female.

plot_title

Plot title

y_title

Y-axis title. Defailts to Percent.

caption_text

Caption text in the bottom right of the graph.

subtitle_text

Subtitle text

ylimits

A vector of the form c(min, max) specifying the extent of the graph's y-axis. Defaults to the minimum and maximum points on the graph with a buffer of 10% of the points' range.

pctiles

Include 25thand 75th percentile lines on graph? Defaults to TRUE.

shading

Replace 25th and 75th percentile lines with shaded areas? (Currently not working.)

label_function

A unique label function to be used in place of the default selected based on y_title.

axis_function

A unique axis label function to be used in place of the default selected based on y_title.

order

Descending or Ascending. (For max_min functions)

zero_start

For max_min functions: should the lines all begin at 0? Defaults to FALSE.

Details

The parameters are organized into six sections:

  • Required: df, var

  • Filter and Adjust Data: rollmean, xmin, xmax, peers, order

  • Add Text to Graph: plot_title, y_title, caption_text, subtitle_text

  • Graph Elements: zero_start, ylimits, pctiles, shading

  • Manipulate Labels: label_function, axis_function

Functions

  • trend(): Creates a peer city trendline graph using a GLP-style data frame.

  • trend_maxmin(): Creates a peer city max-min graph using a GLP-style data frame.

  • trend_data(): Returns the data frame used in the trendline graph

  • trend_data_maxmin(): Returns the data frame used in the max-min graph

Examples

trend(education_county, "bach_plus")

greaterlouisvilleproject/glptools documentation built on Feb. 9, 2025, 11:21 a.m.