reorder_cols | R Documentation |
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.
reorder_cols(data, add_missing_cols = TRUE, rm_extra_cols = FALSE)
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 |
re-ordered data frame
test_data <- tibble::tibble("jurisdiction" = "jail", "City" = "Los Angeles") reorder_cols(test_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.