I need to create a column with unique ID, basically add the row number as an own column. My current data frame looks like this:
V1 V2 1 23 45 2 45 4
Here is a solution that keeps the dplyr piping format and places id in the first column, which may be preferred.
d %>% mutate(id = rownames(.)) %>% select(id, everything())