Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rbind.fill

Combine data.frames by row, filling in missing columns.


Description

rbinds a list of data frames filling missing columns with NA.

Usage

## S3 method for class 'fill'
rbind(...)

Arguments

...

input data frames to row bind together. The first argument can be a list of data frames, in which case all other arguments are ignored. Any NULL inputs are silently dropped. If all inputs are NULL, the output is NULL.

Details

This is an enhancement to rbind that adds in columns that are not present in all inputs, accepts a list of data frames, and operates substantially faster.

Column names and types in the output will appear in the order in which they were encountered.

Unordered factor columns will have their levels unified and character data bound with factors will be converted to character. POSIXct data will be converted to be in the same time zone. Array and matrix columns must have identical dimensions after the row count. Aside from these there are no general checks that each column is of consistent data type.

Value

a single data frame

See Also

Other binding functions: rbind.fill.matrix()

Examples

rbind.fill(mtcars[c("mpg", "wt")], mtcars[c("wt", "cyl")])

plyr

Tools for Splitting, Applying and Combining Data

v1.8.6
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.