What is the difference between union_all and bind_rows?

What is the difference between union_all and bind_rows? They seem to be identical?

mtcars$model <- rownames(mtcars)
first <- mtcars[1:20, ]
second <- mtcars[10:32, ]

a <- union_all(first, second)
b <- bind_rows(first, second)

identical(a, b)

when the inputs are data.frames there is no difference, and union_all is in fact a wrapper of bind_rows (bind_rows is used in its code).
but union_all is generic in so far as it can operate over vector inputs as well

union_all(1:2,3)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.