I had expected rbindlist() to preserve attributes, but it doesn't. It'd be a nice feature; or an important limitation to disclose in the documentation.
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- r
- Domain
- data-engineering
Research direction
Start by reproducing the example with data.table::rbindlist() and inspect the resulting attributes. Determine how attributes such as xa and ya should be handled when inputs differ; done means either preserving the agreed attributes or documenting the limitation clearly.
Written by the indexing model from the issue text.
Description
# Minimal reproducible example
library(data.table)
x <- data.table(0)
setattr(x,"xa",0)
y <- data.table(1)
setattr(y,"ya",1)
z <- rbindlist(list(x,y))
attributes(z)
#> $names
#> [1] "V1"
#>
#> $row.names
#> [1] 1 2
#>
#> $class
#> [1] "data.table" "data.frame"
#>
#> $.internal.selfref
#> <pointer: 0x00000239858df980>
# I had expected attributes(z) to include at least "xa", or both "xa" and "ya".
Created on 2022-12-20 with reprex v2.0.2
# Output of sessionInfo()
sessionInfo()
#> R version 4.2.2 (2022-10-31 ucrt)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 22621)
#>
#> Matrix products: default
#>
#> locale:
#> [1] LC_COLLATE=English_New Zealand.utf8 LC_CTYPE=English_New Zealand.utf8
#> [3] LC_MONETARY=English_New Zealand.utf8 LC_NUMERIC=C
#> [5] LC_TIME=English_New Zealand.utf8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] rstudioapi_0.14 knitr_1.41 magrittr_2.0.3 R.cache_0.16.0
#> [5] rlang_1.0.6 fastmap_1.1.0 stringr_1.5.0 styler_1.8.1
#> [9] highr_0.9 tools_4.2.2 xfun_0.34 R.oo_1.25.0
#> [13] cli_3.4.1 withr_2.5.0 htmltools_0.5.3 yaml_2.3.6
#> [17] digest_0.6.29 lifecycle_1.0.3 purrr_0.3.5 vctrs_0.5.0
#> [21] R.utils_2.12.2 fs_1.5.2 glue_1.6.2 evaluate_0.18
#> [25] rmarkdown_2.18 reprex_2.0.2 stringi_1.7.8 compiler_4.2.2
#> [29] R.methodsS3_1.8.2
Created on 2022-12-20 with reprex v2.0.2
- Dominant language
- R
- Stars
- 3.9k
- Forks
- 1.1k
- Avg merge
- 14h 4m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Rdatatable/data.table
-
as.data.table() recurses without end on a survival::Surv object (or any data.frame carrying one) Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Rdatatable/data.table#7887 ·
-
consistency tests
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Rdatatable/data.table#7853 · 3 comments ·
-
internals
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Rdatatable/data.table#6938 · 1 comment ·
-
encoding fread
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Rdatatable/data.table#5179 · 8 comments ·
-
documentation programming
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Rdatatable/data.table#3199 · 3 comments ·
All issues in Rdatatable/data.table
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
beginners blocker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enviPathR OpenBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Bioconductor/BiocContributions#207 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
datacarpentry/semester-biology#1255 ·