RStudio rownames_to_column - How to find name of first column to use in this function?

You asked why a column would not have a name and it was pointed out that these are rownames.

The reason (I believe) is that dataframes were not included in R at the start and were added later on. (Dataframes are lists of vectors).

Think about a matrix which has optional rownames (and colnames). The rownames are not part of the matrix data because a matrix has a uniform data type. Rownames for dataframes are thus the equivalent of rownames for matrices.

In order to rectify this (mainly) undesirable feature, tibbles and data.tables, which are both enhanced dataframes, do not use rownames.

2 Likes