Add columns to a data frame
This is a convenient way to add one or more columns to an existing data frame.
add_column( .data, ..., .before = NULL, .after = NULL, .name_repair = c("check_unique", "unique", "universal", "minimal") )
.data |
Data frame to append to. |
... |
< |
.before, .after |
One-based column index or column name where to add the new columns, default: after last column. |
.name_repair |
Treatment of problematic column names:
This argument is passed on as |
Other addition:
add_row()
# add_column --------------------------------- df <- tibble(x = 1:3, y = 3:1) df %>% add_column(z = -1:1, w = 0) df %>% add_column(z = -1:1, .before = "y") # You can't overwrite existing columns try(df %>% add_column(x = 4:6)) # You can't create new observations try(df %>% add_column(z = 1:5))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.