RankTable: Figure containing a table of ranking data.

Description Usage Arguments Details See Also Examples

View source: R/RankTable.R

Description

RankTable creates a figure with a table of ranking data. This may not look very good plotted on its own. Rather, it is meant for use within RankPlotWithTable, which draws this table aligned with a plot of the data in one combined figure.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
RankTable(
  ranks,
  names,
  est,
  se,
  placeType = "State",
  col1 = 0.15,
  col2 = 0.6,
  col3 = 0.85,
  col4 = 1,
  textPos = 2,
  titleCex = 0.9,
  titleLift = 1.5,
  contentCex = 0.7,
  columnsPlotRefLine = NULL,
  tikzText = FALSE
)

Arguments

ranks

Vector containing the rank of each area.

names

Vector containing the name of each area.

est, se

Vectors containing the point estimate and its standard error for each area. See vignettes for examples of using formatC to turn the numeric estimates or SEs into strings, for printing with a consistent number of decimal places.

placeType

String, naming the type of places or units being ranked.

col1, col2, col3, col4

Numeric values between 0 and 1, showing where each column's right-hand-side endpoint is along the table's width. In other words, colJ should be the fraction of the table's total width at which the Jth column should end, if using default of right-aligned columns (unless textPos != 2). Use col4 = 1 unless you want the table to be narrower than the space available, or unless you switch to centered or left-aligned columns.

textPos

Passed to pos argument of text. Default of 2 ensures each column of text is right-justified.

titleCex

Character expansion factor for column titles.

titleLift

Numeric value for how many row-heights to raise column titles above top row of column contents.

contentCex

Character expansion factor for column contents (all column text except the titles).

columnsPlotRefLine

Optional numeric value. If not NULL, how many row-heights below bottom row of column contents to print the phrase "Reference State:" (or "Reference <placeType>:") as a label for bottom row of columns plot.

tikzText

Logical, for whether or not to format text for tikz plotting.

Details

This function is currently hardcoded to give a table with four columns, with given column names. Users may wish to modify this code and write their own table function, which can be swapped into tableFunction within RankPlotWithTable. Be aware that RankPlotWithTable uses layout to arrange the table and plot side-by-side, so layout cannot be used within a new tableFunction.

See Also

RankPlotWithTable and RankPlot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Table of US states' mean travel times to work, from the 2011 ACS
data(TravelTime2011)
# Just as inside RankPlotWithTable(),
# we have to set par(xpd=TRUE)
# and adjust the plotting margins
oldpar <- par(no.readonly = TRUE)
oldmar <- par('mar')
par(xpd=TRUE, mar=c(oldmar[1],0,oldmar[3],0))
with(TravelTime2011,
     RankTable(ranks = Rank, names = State,
               est = Estimate.2dec, se = SE.2dec,
               placeType = "State"))
par(oldpar)

Example output



RankingProject documentation built on Jan. 29, 2022, 1:08 a.m.