add_cols_and_reorder | R Documentation |
Add missing columns with names in 'by' not in the column names of 'tab'. Order the table, ignoring the first column in the order given in the 'by' vector. Optionally, set all NAs to 0s in the data columns only.
add_cols_and_reorder(tab, by, replace_na = TRUE)
tab |
data frame with years as the first column, and N columns of data with names |
by |
a vector of names, which correspond to the names of the columns in tab |
replace_na |
logical; replace NAs with zeros (default TRUE) |
a modified data frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.