Learn R Programming

tidytable (version 0.8.0)

nest.: Nest data.tables

Description

Nest data.tables

Usage

nest.(.df, ..., .names_sep = NULL)

Arguments

.df

A data.table or data.frame

...

Columns to be nested.

.names_sep

If NULL, the names will be left alone. If a string, the names of the columns will be created by pasting together the inner column names and the outer column names.

Examples

Run this code
df <- data.table(
  a = 1:10,
  b = 11:20,
  c = c(rep("a", 6), rep("b", 4)),
  d = c(rep("a", 4), rep("b", 6))
)

df %>%
  nest.(data = c(a, b))

df %>%
  nest.(data = where(is.numeric))

Run the code above in your browser using DataLab