df_to_ldf: Transform data.frame to a list of data.frames

df_to_ldfR Documentation

Transform data.frame to a list of data.frames

Description

Splits a data.frame by a variable and returns a named list.

Usage

df_to_ldf(data, by, remove_by = T)

Arguments

data

(data.frame) The data.frame.

by

(character scalar or vector) The values to split by. If input is a character scalar, will use that variable from the data.frame. If it is a longer vector, will use that to split with.

remove_by

(logical scalar) Whether to remove the vector used to split with from the data.frame. Only relevant when using a character scalar as input to by.

Examples

df_to_ldf(iris[c(1:5, 51:55, 101:105), ], "Species") #split iris by Species.

Deleetdk/kirkegaard documentation built on Feb. 28, 2025, 5:04 p.m.