spine_rescaler: Rescale spine data

Description Usage Arguments Value

View source: R/spine_chart_utils.R

Description

Rescales data so it can be plotted on a spine chart

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
spine_rescaler(
  data,
  area_code,
  indicator,
  significance,
  polarity,
  area_type,
  value,
  timeperiod,
  local_area_code,
  median_line_area_code,
  comparator_area_code = NA,
  percent_display,
  dps = 1
)

Arguments

data

a data frame to create the spine chart from. the data frame should contain data for all area types included in the chart (eg, if plotting for County & UA with a comparator of region and a median line for national, the data frame should contain all of these data)

area_code

unquoted field name where area codes are stored (local_area_code, median_line_area_code and comparator_area_code, if using, should all exist in this field)

indicator

unquoted field name of the field containing the indicator labels. Take care as errors will occur where indicator labels are the same but data exist for multiple sub-categories (for example, sex or age)

significance

unquoted field name describing the statistical significance for that indicator (eg, Better, Worse, Similar etc)

polarity

unquoted field name containing the polarity information (currently only handles polarity returned by fingertipsR package)

area_type

unquoted field name containing area type information. This ensures the vertabra are only plotted for the same area types as the local_area area type (eg, when plotting a spine chart for County & UA areas, regions and national area types will be removed)

value

unquoted field name containing the values to be plotted

timeperiod

unquoted field name of the time period field

local_area_code

string; the code of the area that the spine chart is being drawn for

median_line_area_code

string; area code for the median line. Defaults to "E92000001" (England)

comparator_area_code

string; area code for the comparator point. Defaults to NA

percent_display

number between 0 and 1; the percentage of values that needs to exist for a spine to display. Default is 0.25

dps

number; number of decimal places to be displayed in the data table. The default is 1. Set to NA if this should be the same as the input data

Value

A list containing "bars" and "points" which contains data that can be passed to the phe_spine_chart function


fingertipscharts documentation built on July 2, 2020, 2:59 a.m.