-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Hey! I know that row names on tibbles are deprecated (which I disagree with but that is beside the point) but I think that for now, given that someone wants to continue using this deprecated feature, functions like mutate should not drop rownames in cases by default where the user wants to keep them. There are constructs outside of the tidyverse that still use rownames; for example the bioconductor object 'eset' uses them in important ways and there are tools that take esets and not more modern bioconductor objects. So if I want to use tibbles and dplyr verbs when constructing esets I have to do inconvenient workarounds, or not use dplyr. So what I want is for tidyverse functions to preserve rownames wherever possible, even though I know it is not possible with certain things (like joins where rows are added).
Here is a simple example:
library(tidyverse)
small_tibble <- mpg[1:3,1:3]
rownames(small_tibble) <- c("snap","cracke","pop")
print(rownames(small_tibble)) #setting rownames was successful
small_tibble_mutated <- small_tibble %>% mutate(displ = displ^2)
print(rownames(small_tibble_mutated)) #rownames disappeared