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

There is a limit on the number of rows in a table #1939

Open
Hernan-Z opened this issue Jun 13, 2024 · 0 comments
Open

There is a limit on the number of rows in a table #1939

Hernan-Z opened this issue Jun 13, 2024 · 0 comments

Comments

@Hernan-Z
Copy link

Started when i tried an arithmetic (^2 but using *) in a mutate on a column created using a summarise and n() and one of the results was NA. Because of the warning, i learned that n() returns a integer class number (i don't see this class often) and later, that some operations with integers actually give results of class double.
For curiosity, i wondered if n() can count tables with 2^31 or more rows, but when i tried to create a table with 2^31 rows, i got this error message:

Error en if (mirn && nrows[i] > 0L) {: 
  valor ausente donde TRUE/FALSE es necesario
Además: Aviso:
In attributes(.Data) <- c(attributes(.Data), attrib) :
  NAs introduced by coercion to integer range

(second row: missing value where TRUE/FALSE is necessary)
I didn't understand why happened, until 2^31 - 1 rows worked. So i tried adding 1 row with bin_rows and a small table, got this error saying to report it, and here i am, i created a github account to share this.

long_table = data.frame(a = 1:(2^31-1))
short_table = data.frame(a = 1)
library(dplyr)
#> 
#> Adjuntando el paquete: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
new_table = bind_rows(long_table,short_table)
#> Error in `vec_rbind()`:
#> ! Negative `n` in `compact_rep()`.
#> ℹ In file 'utils.c' at line 897.
#> ℹ This is an internal error that was detected in the vctrs package.
#>   Please report it at <https://github.com/r-lib/vctrs/issues> with a reprex (<https://tidyverse.org/help/>) and the full backtrace.

Created on 2024-06-13 with reprex v2.1.0

(By the way, i solved the NA value by adding a *1 before the first number, but i guess it's safer convert the class of the column created with n() to double right after the column creation.) (or using as.double(n()))

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