Similar in spirit to tidyr::unnest(), the reverse of tf_nest.

tf_unnest(
  data,
  ...,
  .arg,
  .drop = NA,
  .id = "id",
  .sep = "_",
  .preserve = NULL,
  try_dropping = TRUE
)

Arguments

data

a data frame

...

optional: a selection of tf-columns. If empty, all tf-variables in the data frame are selected. You can supply bare variable names, select all variables between x and z with x:z, exclude y with -y. For more options, see the dplyr::select() documentation.

.arg

optional values for the arg argument of tf_evaluate.data.frame()

.drop

Should additional list columns be dropped? By default, unnest() will drop them if unnesting the specified columns requires the rows to be duplicated.

.id

Data frame identifier - if supplied, will create a new column with name .id, giving a unique identifier. This is most useful if the list column is named.

.sep

If non-NULL, the names of unnested data frame columns will combine the name of the original list-col with the names from the nested data frame, separated by .sep.

.preserve

Optionally, list-columns to preserve in the output. These will be duplicated in the same way as atomic vectors. This has dplyr::select() semantics so you can preserve multiple variables with .preserve = c(x, y) or .preserve = starts_with("list").

try_dropping

should tf_unnest try to avoid duplicating id or arg columns? Defaults to TRUE.

Value

a "long" data frame with tf-columns expanded into id, arg, value- columns.

See also

tf_gather(), tf_unnest(), tf_evaluate.data.frame()