bind_cols.: Bind data.tables by row and column

Description Usage Arguments Examples

View source: R/bind.R

Description

Bind multiple data.tables into one row-wise or col-wise.

Usage

1
2
3
bind_cols.(..., .name_repair = "unique")

bind_rows.(..., .id = NULL)

Arguments

...

data.tables or data.frames to bind

.name_repair

Treatment of duplicate names. See ?vctrs::vec_as_names for options/details.

.id

If TRUE, an integer column is made as a group id

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Binding data together by row
df1 <- data.table(x = 1:3, y = 10:12)
df2 <- data.table(x = 4:6, y = 13:15)

df1 %>%
  bind_rows.(df2)

# Can pass a list of data.tables
df_list <- list(df1, df2)

bind_rows.(df_list)

# Binding data together by column
df1 <- data.table(a = 1:3, b = 4:6)
df2 <- data.table(c = 7:9)

df1 %>%
  bind_cols.(df2)

# Can pass a list of data frames
bind_cols.(list(df1, df2))

mtfairbanks/gdt documentation built on May 4, 2021, 9:44 a.m.