Or you can use tibble
‘s rownames_to_column
which does the same thing as David’s answer:
library(tibble)
df <- tibble::rownames_to_column(df, "VALUE")
Note: The earlier function called add_rownames()
has been deprecated and is being replaced by tibble::rownames_to_column()