add_id_col() adds an id column to either a data frame or to each data frame in a list.

listindex_to_col() adds the listindex from the first list of a list of data frames as an ID column in each of the nested data frames.

add_id_col(.data, value = 1L, var = "doc_id")

listindex_to_col(.data, var = "doc_id")

Arguments

.data

A list (or list of lists) of data frames.

value

A value to assign as the id.

var

Character name of the new id column.

See also