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

Integer overflow with ntile() and large tiles + numbers of records #4186

Closed
krlmlr opened this issue Feb 15, 2019 · 1 comment
Closed

Integer overflow with ntile() and large tiles + numbers of records #4186

krlmlr opened this issue Feb 15, 2019 · 1 comment
Milestone

Comments

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Feb 15, 2019

#4185 (comment)

library(tidyverse)

tibble(a = 1:1e2) %>%
  mutate(b = ntile(n = 1e2)) %>%
  count(b) %>%
  tail()
#> # A tibble: 6 x 2
#>       b     n
#>   <int> <int>
#> 1    95     1
#> 2    96     1
#> 3    97     1
#> 4    98     1
#> 5    99     1
#> 6   100     1

tibble(a = 1:1e3) %>%
  mutate(b = ntile(n = 1e3)) %>%
  count(b) %>%
  tail()
#> # A tibble: 6 x 2
#>       b     n
#>   <int> <int>
#> 1   995     1
#> 2   996     1
#> 3   997     1
#> 4   998     1
#> 5   999     1
#> 6  1000     1

tibble(a = 1:1e4) %>%
  mutate(b = ntile(n = 1e4)) %>%
  count(b) %>%
  tail()
#> # A tibble: 6 x 2
#>       b     n
#>   <int> <int>
#> 1  9995     1
#> 2  9996     1
#> 3  9997     1
#> 4  9998     1
#> 5  9999     1
#> 6 10000     1

tibble(a = 1:1e5) %>%
  mutate(b = ntile(n = 1e5)) %>%
  count(b) %>%
  tail()
#> # A tibble: 6 x 2
#>       b     n
#>   <int> <int>
#> 1 21470     2
#> 2 21471     2
#> 3 21472     2
#> 4 21473     2
#> 5 21474     2
#> 6 21475     2

Created on 2019-02-15 by the reprex package (v0.2.1.9000)

@krlmlr krlmlr added this to the 0.8.1 milestone Feb 16, 2019
@lock
Copy link

@lock lock bot commented Sep 1, 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 Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant