create_datatable: Data table supporting information

Description Usage Arguments Value

View source: R/spine_chart_utils.R

Description

Returns a data frame containing the data that sits next to the spine chart

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
create_datatable(
  data,
  indicator,
  area_code,
  timeperiod,
  trend,
  count,
  value,
  local_area_code,
  median_line_area_code,
  comparator_area_code,
  dps = 1,
  header_width,
  horizontal_arrow_multiplier
)

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)

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)

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)

timeperiod

unquoted field name of the time period field

trend

unquoted field name of the trend field; if the user doesn't want to display trend information then leave this incomplete and amend the header_labels argument to remove the Trend header. Text within this field should contain one of the following words to control the arrows that are displayed; "decreasing", "increasing", "no significant change", "could not be calculated". The text within this field should contain one of the following words to control the colour; "better", "worse", "no significant change". If none of these words appear in the string, the words "increasing" or "decreasing" will be used to colour the arrows in different shades of blue"

count

unquoted field name where the count (numerator) is stored

value

unquoted field name containing the values to be plotted

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

dps

number of decimal places to use in the data table

header_width

x dimension of chart to be used for normalising the arrow length when horizonal

horizontal_arrow_multiplier

number to scale horizontal trend arrows. A value below 1 will shorten the arrows

Value

A data frame containing the information that sits alongside the spine chart


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