% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unnest.R
\name{unnest}
\alias{unnest}
\title{Unnest List Columns}
\usage{
unnest(x, cols, prefix = NULL)
}
\arguments{
\item{x}{(\code{\link[data.table:data.table]{data.table::data.table()}})\cr
\code{\link[data.table:data.table]{data.table::data.table()}} with columns to unnest.}

\item{cols}{(\code{character()})\cr
Column names of list columns to operate on.}

\item{prefix}{(\code{logical(1)} | \code{character(1)})\cr
String to prefix the new column names with.
Use \code{"{col}"} (without the quotes) as placeholder for the original column name.}
}
\value{
(\code{\link[data.table:data.table]{data.table::data.table()}}).
}
\description{
Transforms list columns to separate columns, possibly by reference.
The original columns are removed from the returned table.
All non-atomic objects in the list columns are expanded to new list columns.
}
\examples{
x = data.table::data.table(
  id = 1:2,
  value = list(list(a = 1, b = 2), list(a = 2, b = 2))
)
print(x)
unnest(data.table::copy(x), "value")
unnest(data.table::copy(x), "value", prefix = "{col}.")
}
