convert row names to column in r code example
Example 1: turn row names into column in r
d <- cbind(rownames(d), data.frame(d, row.names=NULL))
Example 2: turn row names into column in r
data$row_names <- row.names(data) # Apply row.names function
data # Print updated data
# x1 x2 row_names
# 1 A e 1
# 2 B d 2