How to convert a list to a data frame in R
· 1 min read · Updated March 14, 2026 · beginner
r data-types lists data-frames tidyverse
Lists often result from reading JSON data or scraping websites. Here is how to convert them to data frames.
Using as.data.frame()
The simplest approach for named lists with equal-length elements:
my_list <- list(
name = c("Alice", "Bob", "Charlie"),
age = c(25, 30, 35)
)
df <- as.data.frame(my_list)
# name age
# 1 Alice 25
# 2 Bob 30
# 3 Charlie 35
Using dplyr::bind_rows()
Handles lists with different lengths by padding with NA:
library(dplyr)
my_list <- list(
name = c("Alice", "Bob"),
score = c(85, 90, 78)
)
df <- bind_rows(my_list)
# name score
# 1 Alice 85
# 2 Bob 90
# 3 NA 78
Using data.table::rbindlist()
Fastest option for large lists:
library(data.table)
my_list <- list(
name = c("Alice", "Bob"),
age = c(25, 30)
)
df <- as.data.frame(rbindlist(my_list))
See Also
- list — The list data type
- data.frame — How data frames work
- tibble — tidyverse tibble