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

safe_bind_rows

Stack data frames which may have differing types in the same column


Description

This function accepts a list of data frames and will stack them all and return a tbl_df with missing values filled in and all columns stacked regardless of if the datatypes were different within the same column.

Usage

safe_bind_rows(l, fill = TRUE, idcol = NULL, ...)

Arguments

l

list; A list containing data frames or lists that can be coerced to data frames.

fill

logical; TRUE fills missing columns with NA (default TRUE). When TRUE, use.names is set to TRUE.

idcol

character; Creates a column in the result showing which list item those rows came from. TRUE names this column ".id". idcol="file" names this column "file".

...

arguments passed to rbindlist

Value

tbl_df; all list elements stacked on top of each other to form a single data frame

Note

This function is meant to be used internally. Only use when debugging.


salesforcer

An Implementation of 'Salesforce' APIs Using Tidy Principles

v0.2.2
MIT + file LICENSE
Authors
Steven M. Mortimer [aut, cre], Takekatsu Hiramura [ctb], Jennifer Bryan [ctb, cph], Joanna Zhao [ctb, cph]
Initial release
2020-09-07

We don't support your browser anymore

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