ranking | R Documentation |
Creates a peer city ranking graph using a GLP-style data frame.
Columns FIPS
is a required column.
Columns year
, sex
, and race
are optional columns.
ranking(
df,
var,
plot_title = "",
year = NULL,
sex = "total",
race = "total",
peers = "Current",
order = "Descending",
y_title = "Percent",
caption_text = "",
subtitle_text = "",
bar_label = TRUE,
sigfig = 3,
accuracy = 0.1,
label_function,
alternate_text = NULL,
ranking_colors = TRUE
)
ranking_data(
df,
variables,
years = "",
sex = "total",
race = "total",
descending = TRUE,
peers = "Current",
new_vars = ""
)
df |
A data frame |
var |
The variable name, can be quoted or unquoted |
plot_title |
Plot title |
year |
The year of observations to use.
Defaults to the most recent year of data available for |
sex |
Filters |
race |
Filters |
peers |
|
order |
|
y_title |
Y-axis title. Defailts to |
caption_text |
Caption text in the bottom right of the graph.. |
subtitle_text |
Subtitle text |
bar_label |
Add labels to bars? Defaults to |
sigfig |
Number of significant digits in bar labels. |
accuracy |
Accuract of bar labels |
label_function |
A unique label function to be used in place of the default selected based on |
alternate_text |
A numeric vector that specifies which, if any, bar labels should be moved to the right side of the bar. This is used to prevent text from being hidden due to small bars. |
The parameters are organized into four sections:
Required: df
, var
Filtering and Sorting: year
, sex
, race
, peers
, order
Add Text: plot_title
, y_title
, caption_text
, subtitle_text
Manipulate Bar Labels: bar_label
, sigfig
, accuracy
, label_function
, alternate_text
ranking_data()
: Outputs ranking data from inside the ranking function
ranking(education_county, bach_plus, plot_title = "Bachelor's or Higher", caption_text = "GLP")
ranking(jobs_county, median_earnings_gap_bw, plot_title = "Median Earnings", caption_text = "GLP",
label_function = scales::dollar_format(accuracy = 1), alternate_text = 12:17)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.