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

Corrupted integer64 on pmap #430

Closed
refik opened this issue Dec 19, 2017 · 1 comment
Closed

Corrupted integer64 on pmap #430

refik opened this issue Dec 19, 2017 · 1 comment

Comments

@refik
Copy link

refik commented Dec 19, 2017

When an integer64 containing data frame is passed to pmap(), the iterative function receives the number in a corrupted form.

int64_df <- dplyr::tibble(int64 = bit64::as.integer64(1:3))
purrr::pmap(int64_df, function(int64) int64)
#> [[1]]
#> [1] 4.940656e-324
#> 
#> [[2]]
#> [1] 9.881313e-324
#> 
#> [[3]]
#> [1] 1.482197e-323

This problem can also be replicated by a call to as.list(). Call to as.list() can be "fixed" by creating an S3 method, but the call to pmap() is still problematic after that "fix".

as.list(bit64::as.integer64(1:3))
#> [[1]]
#> [1] 4.940656e-324
#> 
#> [[2]]
#> [1] 9.881313e-324
#> 
#> [[3]]
#> [1] 1.482197e-323
as.list.integer64 <- function(int64) purrr::map(int64, ~.)
as.list(bit64::as.integer64(1:3))
#> [[1]]
#> integer64
#> [1] 1
#> 
#> [[2]]
#> integer64
#> [1] 2
#> 
#> [[3]]
#> integer64
#> [1] 3
Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.4.2 (2017-09-28)
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  tz       Europe/Istanbul             
#>  date     2017-12-19
#> Packages -----------------------------------------------------------------
#>  package   * version    date       source                          
#>  backports   1.1.2      2017-12-13 CRAN (R 3.4.3)                  
#>  base      * 3.4.2      2017-10-04 local                           
#>  bit         1.1-12     2014-04-09 CRAN (R 3.4.0)                  
#>  bit64       0.9-7      2017-05-08 CRAN (R 3.4.0)                  
#>  compiler    3.4.2      2017-10-04 local                           
#>  datasets  * 3.4.2      2017-10-04 local                           
#>  devtools    1.13.4     2017-11-09 CRAN (R 3.4.2)                  
#>  digest      0.6.12     2017-01-27 CRAN (R 3.4.0)                  
#>  evaluate    0.10.1     2017-06-24 CRAN (R 3.4.0)                  
#>  graphics  * 3.4.2      2017-10-04 local                           
#>  grDevices * 3.4.2      2017-10-04 local                           
#>  htmltools   0.3.6      2017-04-28 CRAN (R 3.4.0)                  
#>  knitr       1.17       2017-08-10 CRAN (R 3.4.1)                  
#>  magrittr    1.5        2014-11-22 CRAN (R 3.4.0)                  
#>  memoise     1.1.0      2017-04-21 CRAN (R 3.4.0)                  
#>  methods   * 3.4.2      2017-10-04 local                           
#>  purrr       0.2.4.9000 2017-12-02 Github (tidyverse/purrr@62b135a)
#>  Rcpp        0.12.14    2017-11-23 CRAN (R 3.4.3)                  
#>  rlang       0.1.4      2017-11-05 CRAN (R 3.4.2)                  
#>  rmarkdown   1.6        2017-06-15 CRAN (R 3.4.0)                  
#>  rprojroot   1.2        2017-01-16 CRAN (R 3.4.0)                  
#>  stats     * 3.4.2      2017-10-04 local                           
#>  stringi     1.1.6      2017-11-17 CRAN (R 3.4.2)                  
#>  stringr     1.2.0      2017-02-18 CRAN (R 3.4.0)                  
#>  tools       3.4.2      2017-10-04 local                           
#>  utils     * 3.4.2      2017-10-04 local                           
#>  withr       2.1.0      2017-11-01 CRAN (R 3.4.2)                  
#>  yaml        2.1.15     2017-12-01 CRAN (R 3.4.3)
@lionel-
Copy link
Member

lionel- commented Dec 19, 2017

Duplicate of #358

@lionel- lionel- marked this as a duplicate of #358 Dec 19, 2017
@hadley hadley closed this as completed Jan 16, 2018
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

3 participants