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

Warning on merge: longer object length is not a multiple of shorter object length #3061

Closed
renkun-ken opened this issue Sep 22, 2018 · 2 comments
Closed
Milestone

Comments

@renkun-ken
Copy link
Member

@renkun-ken renkun-ken commented Sep 22, 2018

When I upgrade data.table to the latest release (1.11.6) from 1.11.4, the following code produces a warning:

library(data.table)
d1 <- data.table(
  S_INFO_WINDCODE = c("000001.SZ", "000001.SZ", 
    "000001.SZ", "000001.SZ", "000001.SZ"), 
  ANN_DT = c(19900321L, 19901231L, 19901231L, 19901231L, 19901231L), 
  REPORT_PERIOD = c(19891231L, 19891231L, 19900331L, 19900630L, 19900930L), 
  REPORT_YEAR = c(1989L, 1989L, 1990L, 1990L, 1990L), 
  REPORT_QUARTER = c(4L, 4L, 1L, 2L, 3L),
  key = c("S_INFO_WINDCODE", "ANN_DT", "REPORT_PERIOD"))
d2 <- data.table(
  S_INFO_WINDCODE = c("000001.SZ", "000001.SZ", 
  "000001.SZ", "000001.SZ", "000001.SZ"), 
  ANN_DT = c(19900321L, 19901231L, 19901231L, 19901231L, 19901231L), 
  REPORT_PERIOD = c(19891231L, 19891231L, 19900331L, 19900630L, 19900930L), 
  REPORT_YEAR = c(1989L, 1989L, 1990L, 1990L, 1990L), 
  REPORT_QUARTER = c(4L, 4L, 1L, 2L, 3L),
  key = c("S_INFO_WINDCODE", "ANN_DT", "REPORT_PERIOD"))
d3 <- merge(d1, d2, by = c("S_INFO_WINDCODE", "ANN_DT", "REPORT_PERIOD", "REPORT_YEAR", "REPORT_QUARTER"))
Warning message:
In head(key(i), length(leftcols)) == names(i)[leftcols] :
  longer object length is not a multiple of shorter object length

My session info:

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] data.table_1.11.6

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1   

It is reproducible under macOS + R 3.5, Ubuntu 16.04 + R 3.5, Ubuntu 16.04 + R 3.4, Ubuntu 18.04 + R 3.5.

@renkun-ken
Copy link
Member Author

@renkun-ken renkun-ken commented Sep 23, 2018

I did some debugging and the following code will trigger the warning

d2[d1, on = c("S_INFO_WINDCODE", "ANN_DT", "REPORT_PERIOD", "REPORT_YEAR", "REPORT_QUARTER")]

The warning happens at https://github.com/Rdatatable/data.table/blob/master/R/data.table.R#L1331

renkun-ken added a commit to renkun-ken/data.table that referenced this issue Sep 23, 2018
@mattdowle mattdowle added this to the 1.11.8 milestone Sep 24, 2018
@mattdowle
Copy link
Member

@mattdowle mattdowle commented Sep 24, 2018

Closed by #3063

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

2 participants