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

arrange(-x) not working as I expect with integer64 class #4366

Closed
moodymudskipper opened this issue May 16, 2019 · 3 comments
Closed

arrange(-x) not working as I expect with integer64 class #4366

moodymudskipper opened this issue May 16, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@moodymudskipper
Copy link

@moodymudskipper moodymudskipper commented May 16, 2019

I get integer64 columns when collecting from a postgresql databsewith dplyr/dbplyr, arrange(x) and arrange(desc(x)) work as expected on these columns, but arrange(-x) doesn't.

See below :

library(dplyr,warn.conflicts = FALSE)
df1 <- data.frame(x = letters[1:3], y = c(1,3,2))

identical(arrange(df1, -y), arrange(df1, desc(y)))
#> [1] TRUE

df1$y <- bit64::as.integer64(df1$y)
identical(arrange(df1, -y), arrange(df1, desc(y)))
#> [1] FALSE

# not what I expect
arrange(df1, -y)
#>   x y
#> 1 a 1
#> 2 b 3
#> 3 c 2

Created on 2019-05-16 by the reprex package (v0.2.1)

@moodymudskipper
Copy link
Author

@moodymudskipper moodymudskipper commented May 16, 2019

Another issue with integer64, with tidyr but these might stem from the same issue so I'll put it here. When using spread, instead of NA we find the value 9218868437227407266:

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
data.frame(id = c(1,2,2), key = c("a","a","b"), value = 1:3) %>% 
  mutate(value = bit64::as.integer64(value)) %>%
  tidyr::spread(key, value)
#>   id a                   b
#> 1  1 1 9218868437227407266
#> 2  2 2                   3

Created on 2019-05-16 by the reprex package (v0.2.1)

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented May 20, 2019

Eventually (after r-lib/vctrs#348, for version 0.9.*) we should be able to use vec_order(). I'll put a workaround in for 0.8.2

@romainfrancois romainfrancois added this to the 0.8.2 milestone May 20, 2019
@romainfrancois romainfrancois self-assigned this May 20, 2019
@lock
Copy link

@lock lock bot commented Nov 17, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Nov 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants