% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tidyr.R
\name{tf_nest}
\alias{tf_nest}
\title{Turn "long" tables into tidy data frames with \code{tf}-objects}
\usage{
tf_nest(
  data,
  ...,
  .id = "id",
  .arg = "arg",
  domain = NULL,
  evaluator = "tf_approx_linear"
)
}
\arguments{
\item{data}{a data frame}

\item{...}{A selection of columns. If empty, all variables except the
\code{.id} and \code{.arg} columns are selected. You can supply bare variable names,
select all variables between \code{x} and \code{z} with \code{x:z}, exclude \code{y} with \code{-y}.
For more options, see the \code{\link[dplyr:select]{dplyr::select()}} documentation.}

\item{.id}{the (bare or quoted) name of the column defining the different
observations. Defaults to "id".}

\item{.arg}{the (bare or quoted) name of the column defining the \code{arg}-values
of the observed functions. Defaults to "arg".}

\item{domain}{optional. Range of possible \code{arg}-values. See \code{\link[tf:tfd]{tf::tfd()}} for details.}

\item{evaluator}{optional. A function accepting arguments x, arg, evaluations. See \code{\link[tf:tfd]{tf::tfd()}} for details.}
}
\value{
a data frame with (at least) \code{.id} and \code{tfd} columns
}
\description{
Similar in spirit to \code{\link[tidyr:nest]{tidyr::nest()}}. This turns tables in "long" format,
where one column (\code{.id}) defines the unit of observation, one column (\code{.arg})
defines the evaluation grids of the functional observations, and other columns (\code{...})
define the values of the functions at those points into a (much shorter) table containing
\code{tfd}-objects. All other variables are checked for constancy over \code{.id} and
appended as well.
}
\details{
\code{domain} and \code{evaluator} can be specified as lists or vectors
if you are nesting multiple functional data columns with different properties.
Because this interface captures evaluator names as text, supply the evaluator
as a string rather than a bare function name.
}
\examples{
d <- dplyr::tibble(id = rep(1:3, each = 5), arg = rep(1:5, 3), value = rnorm(15))
tf_nest(d, .id = id, .arg = arg)
}
\seealso{
\code{\link[tf:tfd]{tf::tfd()}} for details on \code{domain} and \code{evaluator}.

Other tidyfun data wrangling functions: 
\code{\link{tf_evaluate.data.frame}()},
\code{\link{tf_gather}()},
\code{\link{tf_spread}()},
\code{\link{tf_unnest}()}
}
\concept{tidyfun data wrangling functions}
