Why does mutate (row_number ()) fail for data.tables?

When I try to use row_number()out dplyron data.table table, it gives an error. Here is an example:

library(dplyr)
library(data.table)
mine <- data.table(a = 1:10)
mine %>% mutate(row_number())
# Error in rank(x, ties.method = "first", na.last = "keep") : 
#   argument "x" is missing, with no default

Any ideas why this is happening?

+2
source share

All Articles