# 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))
Run the code above in your browser using DataLab