Description Usage Arguments Value Functions Examples
Rename data frame columns using external crosswalk file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | renamefrom(
.data,
cw_file,
raw,
clean,
label = NULL,
delimiter = NULL,
sheet = NULL,
drop_extra = TRUE,
case_ignore = TRUE,
keep_label = FALSE,
name_label = FALSE
)
renamefrom_(
.data,
cw_file,
raw,
clean,
label = NULL,
delimiter = NULL,
sheet = NULL,
drop_extra = TRUE,
case_ignore = TRUE,
keep_label = FALSE,
name_label = FALSE
)
|
.data |
Data frame or tbl_df |
cw_file |
Either data frame object or string with path to
external crosswalk file, which has columns representing
|
raw |
Name of column in |
clean |
Name of column in |
label |
Name of column in |
delimiter |
String delimiter used to parse
|
sheet |
Specify sheet if |
drop_extra |
Drop extra columns in current data frame if they
are not matched in |
case_ignore |
Ignore case when matching current ( |
keep_label |
Keep current label, if any, on data frame columns
that aren't matched in |
name_label |
Use old ( |
Data frame or tbl_df with new column names and labels.
renamefrom_
: Standard evaluation version of
renamefrom
(raw
, clean
, and
label
must be strings when using this version)
1 2 3 4 5 6 7 8 9 10 11 | df <- data.frame(state = c('Kentucky','Tennessee','Virginia'),
fips = c(21,47,51),
region = c('South','South','South'))
cw <- data.frame(old_name = c('state','fips'),
new_name = c('stname','stfips'),
label = c('Full state name', 'FIPS code'))
df1 <- renamefrom(df, cw, old_name, new_name, label)
df2 <- renamefrom(df, cw, old_name, new_name, name_label = TRUE)
df3 <- renamefrom(df, cw, old_name, new_name, drop_extra = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.