duplicate names on simple operation

Open
#3,644 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start by reproducing the issue's toy data and dt[, mean(V2), by = V1] operation with the reported data.table and R versions. Trace the column-name handling involved in that operation, then add or update coverage so the result no longer contains duplicate V1 names.

Written by the indexing model from the issue text.

Description

breaking-change

Today data.table returned a double V1 name upon a simple operation:

Toy data
dt <- fread("A 2
+ B 3
+ C 4
+ D 5")
operation produces two columns named V1
dt[, mean(V2), by = V1]
   V1 V1
1:  A  2
2:  B  3
3:  C  4
4:  D  5
Session info:
sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default
BLAS:   /usr/lib/libblas/libblas.so.3.7.0
LAPACK: /usr/lib/lapack/liblapack.so.3.7.0

locale:
 [1] LC_CTYPE=es_CO.UTF-8       LC_NUMERIC=C               LC_TIME=es_CO.UTF-8        LC_COLLATE=es_CO.UTF-8    
 [5] LC_MONETARY=es_CO.UTF-8    LC_MESSAGES=es_CO.UTF-8    LC_PAPER=es_CO.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=es_CO.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] zoo_1.8-5         ggplot2_3.1.1     lubridate_1.7.4   data.table_1.12.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1       rstudioapi_0.10  magrittr_1.5     hms_0.4.2        tidyselect_0.2.5 munsell_0.5.0   
 [7] lattice_0.20-38  colorspace_1.4-1 R6_2.4.0         rlang_0.3.4      plyr_1.8.4       stringr_1.4.0   
[13] dplyr_0.8.1      tools_3.6.0      grid_3.6.0       gtable_0.3.0     withr_2.1.2      digest_0.6.19   
[19] lazyeval_0.2.2   assertthat_0.2.1 tibble_2.1.1     crayon_1.3.4     purrr_0.3.2      glue_1.3.1      
[25] labeling_0.3     stringi_1.4.3    compiler_3.6.0   pillar_1.4.0     scales_1.0.0     pkgconfig_2.0.2

Iit seems related to one of the entries in https://github.com/Rdatatable/data.table/issues/3193 (the one by @Atrebas)

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.