df_rows_to_list: Convert data frame rows to list

View source: R/df_rows_to_list.R

df_rows_to_listR Documentation

Convert data frame rows to list

Description

Returns a list of lists with each sub-list being a row of the data frame.

Usage

df_rows_to_list(x, named = TRUE)

Arguments

x

[data.frame]
Data frame.

named

[logical(1)]
Should the sub-lists be named? If TRUE the colnames(x) are used if available. Otherwise names “V1, ...,VX” are used where X equals ncol(x). Default is TRUE.

Value

List of (named) lists.

See Also

Other data frame helpers: df_add_category(), df_add_constant_columns(), df_explode(), df_split_col()

Examples

x = data.frame(x = 1:3, y = letters[3:5])
df_rows_to_list(x)
df_rows_to_list(x, named = FALSE)
df_rows_to_list(unname(x), named = FALSE)

jakobbossek/re documentation built on Nov. 15, 2024, 1:42 a.m.