1

dplyr::lag与第一个条目为 的整数一起工作正常<NA>,但bit64::integer64第一个条目是一个巨大的数字。

这是我的设置:

library(tidyverse)
library(magrittr)
#> ...
library(bit64)
#> Loading required package: bit
#> Attaching package bit
#> ...
#> Attaching package bit64
#> ...
#> The following object is masked from 'package:bit':
#> 
#>     still.identical
#> The following objects are masked from 'package:base':
#> 
#>     :, %in%, is.double, match, order, rank
library(reprex)
sessionInfo()
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-apple-darwin18.6.0 (64-bit)
#> Running under: macOS Mojave 10.14.6
#> 
#> ...     
#> 
#> other attached packages:
#>  [1] reprex_0.3.0    bit64_0.9-7     bit_1.1-14      magrittr_1.5   
#>  [5] forcats_0.4.0   stringr_1.4.0   dplyr_0.8.1     purrr_0.3.2    
#>  [9] readr_1.3.1     tidyr_0.8.3     tibble_2.1.3    ggplot2_3.2.0  
#> [13] tidyverse_1.2.1
#> 
#> ...

这是一个最小的代表:

tib_int64 <- tibble(A_int   = as.integer(c(1,2,3)),
                    A_int64 = as.integer64(c(1,2,3)))

tib_int64 %>% mutate(B = lag(A_int), C = lag(A_int64))
#> # A tibble: 3 x 4
#>   A_int A_int64     B C                  
#>   <int> <int64> <int> <int64>            
#> 1     1 1          NA 9218868437227407266
#> 2     2 2           1                   1
#> 3     3 3           2                   2

列中的第一个条目C应该<NA>B列中的一样。
这是dplyr问题还是bit64问题?这不是太难解决,但这不应该作为一个错误提交吗?

4

0 回答 0