This function converts the row names of a data frame to a specified column. Note that if the specified column already exists, it is overwritten.
Examples
# Convert row names to a column named 'ID'
df <- data.frame(Value = c(10, 20, 30))
rownames(df) <- c("A", "B", "C")
rownamesToCol(df, "ID")
#> Value ID
#> 1 10 A
#> 2 20 B
#> 3 30 C