reorder_cols: Re-orders columns to respect structure of daily scraped data.

View source: R/reorder_cols.R

reorder_colsR Documentation

Re-orders columns to respect structure of daily scraped data.

Description

Reorders columns in a data frame to agree with the existing structure. Throws a warning for missing columns and optionally adds them in as all NA rows. Throws a warning for extra columns and optionally keeps them at the end of the dataframe.

Usage

reorder_cols(data, add_missing_cols = TRUE, rm_extra_cols = FALSE)

Arguments

data

A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

add_missing_cols

logical, add missing columns as all NA rows

rm_extra_cols

logical, remove extra columns

Value

re-ordered data frame

Examples

test_data <- tibble::tibble("jurisdiction" = "jail",
                    "City" = "Los Angeles")
reorder_cols(test_data)


uclalawcovid19behindbars/behindbarstools documentation built on April 22, 2022, 4:08 a.m.