You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
df<-data.frame(Initials=c("a","a","b"),data=c(2,3,4))
my_rows = 1:2
df %>% group_by(Initials) %>% slice(my_rows)
# Initials data
# (fctr) (dbl)
#1 a 2
#2 a 3
#3 b 4
library(data.table)
setDT(df) %>% group_by(Initials) %>% slice(my_rows)
# Initials data
# (fctr) (dbl)
#1 a 2
#2 a 3
#3 b 4
#4 b NA
Personally, I'd prefer to see the latter behavior and think it's more in keeping with standard R behavior, e.g., in (3:1)[c(5,6)]. However, based on #1269 , I think it clashes with your design goals.
In any case, the two cases should give the same result if dplyr is to play nice with data.table objects.
The text was updated successfully, but these errors were encountered:
In this SO post, I noticed this difference:
Personally, I'd prefer to see the latter behavior and think it's more in keeping with standard R behavior, e.g., in
(3:1)[c(5,6)]
. However, based on #1269 , I think it clashes with your design goals.In any case, the two cases should give the same result if dplyr is to play nice with data.table objects.
The text was updated successfully, but these errors were encountered: