Create a gt table with values compared by name, geography, or other grouping variable
Source:R/gt_acs_compare.R
      gt_acs_compare.Rdgt_acs_compare() is a variant of gt_acs() designed to support the
comparison of multiple named areas or multiple geographies side-by-side in a
combined gt table. This function only works if the arrangement of rows is
the same for each group and all groups have the same number of rows.
Usage
gt_acs_compare(
  data,
  .by = name_col,
  name_col = "NAME",
  value_cols = c("estimate", "moe"),
  perc_value_cols = c("perc_estimate", "perc_moe"),
  column_title_col = "column_title",
  variable_col = "variable",
  drop_cols = c(name_col, variable_col, "GEOID"),
  value_col_label = "Est.",
  perc_value_col_label = "% share",
  decimals = 0,
  return_gt = TRUE,
  ...
)Arguments
- data
- Input data table - obj:<data.frame>|obj:<tbl_df>// required- A - data.frameobject or a tibble (- tbl_df).
- .by
- Name of grouping column. Defaults to - name_col
- name_col
- Name column. Defaults to "NAME". Dropped from table by default. 
- variable_col
- Variable column name. Defaults to "variable". Dropped from table by default. 
- drop_cols
- Columns to drop before creating gt table. Defaults to - c(name_col, variable_col, "GEOID")
- value_col_label, perc_value_col_label
- Labels for value/estimate column and percent value/estimate column. Not yet implemented as an option. 
- return_gt
- If - TRUE(default), return a formatted gt table. If- FALSE, return the data frame for a comparison table.
- ...
- Arguments passed on to - gt_acs- combined_spanner
- If not - NULL, combined_spanner is passed to label parameter of- gt::tab_spanner()using both est_cols and perc_cols as the columns parameter.
- column_title_col,column_title_label
- Column title and label. If column_title_label is a string, column_title_col is required. column_title_label can also be a named vector in the format of - c("label" = "column"). column_title_col defaults to "column_title"
- name_col,name_col_label
- Place name column and label. name_col_label can be a string or a named vector (similar to column_title_label). name_col defaults to "NAME" 
- hide_na_cols
- If - TRUE(default), hide columns where all values are- NA.
- drop_geometry
- If - TRUE(default) and data is an sf object, drop geometry before turning the data frame into a table.
- rownames_to_stub
- Use data frame row labels in the stub - scalar<logical>// default:- FALSE- An option to take rownames from the input - datatable (should they be available) as row labels in the display table stub.
- row_group_as_column
- Mode for displaying row group labels in the stub - scalar<logical>// default:- FALSE- An option that alters the display of row group labels. By default this is - FALSEand row group labels will appear in dedicated rows above their respective groups of rows. If- TRUErow group labels will occupy a secondary column in the table stub.
- append_note
- If - TRUE, add source_note to the end of the generated ACS data label. If- FALSE, any supplied source_note will be used instead of an ACS label.
- source_note
- Source note text - scalar<character>// required- Text to be used in the source note. We can optionally use the - md()and- html()functions to style the text as Markdown or to retain HTML elements in the text.
- survey
- ACS survey, "acs5", "acs3", or "acs1". 
- year
- Based on the year and survey, - acs_survey_ts()returns a vector of years for non-overlapping ACS samples to allow comparison.
- prefix
- Text to insert before ACS survey label. 
- table
- One or more table IDs to include in label or source note. 
- end
- A character string appended to the end of the full label. Defaults to ".".