powered by
Group a data frame by one column and convert to named list. Each key becomes a list name; each value column becomes vector.
df2list(data, key_col, value_col, verbose = TRUE)
A named list, where each element is a character vector of values.
A data.frame or tibble to be grouped.
Character. Column name for list names.
Character. Column name for list values.
Logical. Whether to show message. Default = TRUE.
df <- data.frame( cell_type = c("T_cells", "T_cells", "B_cells", "B_cells"), marker = c("CD3D", "CD3E", "CD79A", "MS4A1") ) df2list(df, "cell_type", "marker")
Run the code above in your browser using DataLab