Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slice() shuffles datetime attributes #7655

Open
yjunechoe opened this issue Feb 7, 2025 · 0 comments
Open

slice() shuffles datetime attributes #7655

yjunechoe opened this issue Feb 7, 2025 · 0 comments

Comments

@yjunechoe
Copy link

yjunechoe commented Feb 7, 2025

I'm not entirely sure what's going on here but slice() appears to shuffle the order of class and tzone attributes of datetime columns:

library(dplyr)
df <- data.frame(datetime = lubridate::now(tzone = "UTC"))

attributes(df$datetime)
#> $class
#> [1] "POSIXct" "POSIXt" 
#> 
#> $tzone
#> [1] "UTC"

attributes(slice(df, n())$datetime)
#> $tzone
#> [1] "UTC"
#> 
#> $class
#> [1] "POSIXct" "POSIXt"

This seems specific to dplyr functions that touch rows: so select() and mutate() doesn't do this but filter() and arrange() does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant