Learn R Programming

doBy (version 4.6.27)

rbind_list: Bind list of data frames and add list names as a column

Description

Binds a named list of data frames (or tibbles) into a single data frame. Adds the list name as a new column (first column).

Usage

rbind_list(lst, name = "name")

Value

A data frame or tibble, depending on the class of the input.

Arguments

lst

A named list of data frames or tibbles.

name

A character scalar: name of the column to hold the list names (default "name").

Examples

Run this code
lst <- list(a = data.frame(x = 1:2), b = data.frame(x = 3:4))
rbind_list(lst)

lst <- split(iris, iris$Species)
rbind_list(lst)


Run the code above in your browser using DataLab