How to set the row names of a data frame passed on with the pipe %>% operator?
with the later version of tibble
, a more elegant solution exists:
df <- df %>% pivot(.) %>% tibble::column_to_rownames('ID_full')
Importantly, it works also when the column to turn to the rowname is passed as a variable, which is super-convenient, when inside the function!
will this do?
iris %>% `rownames<-`(seq_len(nrow(iris)))