Skip to contents

Renames referendum data column names to be ready for publication. Useful e.g. to create tables or visualizations.

Usage

prettify_col_names(data)

Arguments

data

RDB referendum data as returned by rfrnds().

Value

A tibble.

Details

Note that

  • column names unknown to this function are not changed.

  • column labels are removed so they aren't inadvertently used instead of the column names (i.a. relevant for gt >= 0.9.0).

See also

Other referendum data transformation functions: as_ballot_dates(), n_rfrnds_per_period(), n_rfrnds(), unnest_var()

Other functions to prettify names: prettify_var_names()

Examples

rdb::rfrnds(quiet = TRUE) |>
  rdb::prettify_col_names()
#> # A tibble: 17,766 × 69
#>    `RDB ID`     `Official ID` `sudd.ch ID` ISO 3166-1 alpha-2 /…¹ Country `Subnational entity` Municipality `Political level` Date       `Former country?` Title
#>    <chr>        <chr>         <chr>        <fct>                  <fct>   <chr>                <chr>        <ord>             <date>     <lgl>             <chr>
#>  1 65096e84481… NA            pl012023     PL                     Poland  NA                   NA           national          2023-10-15 NA                Priv…
#>  2 65096dc1481… NA            pl022023     PL                     Poland  NA                   NA           national          2023-10-15 NA                rais…
#>  3 65096535481… NA            pl032023     PL                     Poland  NA                   NA           national          2023-10-15 NA                Remo…
#>  4 6509625d481… NA            pl042023     PL                     Poland  NA                   NA           national          2023-10-15 NA                Euro…
#>  5 650034e4481… NA            au012023     AU                     Austra… NA                   NA           national          2023-10-14 NA                Esta…
#>  6 64e46f7a481… NA            ec092023     EC                     Ecuador NA                   NA           national          2023-08-20 NA                No c…
#>  7 64e46c8f481… NA            fm082023     FM                     Micron… NA                   NA           national          2023-07-04 NA                Inde…
#>  8 64c8b3ca0b8… NA            fm072023     FM                     Micron… NA                   NA           national          2023-07-04 NA                Prov…
#>  9 64c8b19c0b8… NA            fm062023     FM                     Micron… NA                   NA           national          2023-07-04 NA                Crea…
#> 10 64c8a28d0b8… NA            fm052023     FM                     Micron… NA                   NA           national          2023-07-04 NA                Alte…
#> # ℹ 17,756 more rows
#> # ℹ abbreviated name: ¹​`ISO 3166-1 alpha-2 / ISO 3166-3 alpha-4`
#> # ℹ 58 more variables: Titel <chr>, Titre <chr>, `Original question` <chr>, Question <chr>, `Committee name` <chr>, Result <fct>,
#> #   `Approving subterritories` <dbl>, `Rejecting subterritories` <dbl>, `Total electorate` <int>, `Electorate abroad` <int>, `Yes votes` <int>,
#> #   `No votes` <int>, `Empty votes` <int>, `Invalid votes` <int>, `Subterritorial votes` <list>, `Lower house yes votes` <int>, `Lower house no votes` <int>,
#> #   `Lower house abstentions` <int>, `Upper house yes` <int>, `Upper house No` <int>, `Upper house abstentions` <int>, `Government's position` <fct>,
#> #   `Top-tier political topics` <list>, `Second-tier political topics` <list>, `Third-tier political topics` <list>, Remarks <chr>, `File metadata` <list>, …