Re: [R] rbind() problem

From: Tobias Verbeke <>
Date: Sat, 14 Jun 2008 07:45:24 +0200

Hi array (?),

> Hi, I would like to rbind 2 data frames. They both some common column names, but also some unique column names each, is there any simple function that rbind these 2 data frames with filling NAs for those columns of unique names?

You can use the reshape package by Hadley Wickham for this:

df1 <- data.frame(V1 = rnorm(10),

                   V2 = rnorm(10),
                   V4 = rnorm(10))
df2 <- data.frame(V1 = rnorm(10),
                   V3 = rnorm(10),
                   V4 = rnorm(10))

rbind.fill(df1, df2)

Tobias mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sat 14 Jun 2008 - 05:51:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 14 Jun 2008 - 06:30:41 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive