Skip to content

Commit bab476b

Browse files
Merge branch 'master' into contributing-restore
2 parents b920543 + 2aad337 commit bab476b

File tree

9 files changed

+33
-10
lines changed

9 files changed

+33
-10
lines changed
File renamed without changes.

.devcontainer/r-devel-gcc/devcontainer.json renamed to .devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"build": { "dockerfile": "Dockerfile", "context": "../.." },
2+
"build": { "dockerfile": "r-devel-gcc/Dockerfile", "context": ".." },
33
"customizations": { "vscode": {
44
"extensions": [
55
"REditorSupport.r",

.devcontainer/r-devel-clang-ubsan/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ read.dcf("DESCRIPTION", c("Imports", "Suggests")) |> \
1616

1717
# setup cc()
1818
WORKDIR /root
19-
COPY .devcontainer/r-devel-clang-ubsan/.Rprofile .
19+
COPY .devcontainer/.Rprofile .
2020

2121
# set ubsan flags
2222
WORKDIR .R

.devcontainer/r-devel-gcc/.Rprofile

Lines changed: 0 additions & 2 deletions
This file was deleted.

.devcontainer/r-devel-gcc/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ read.dcf("DESCRIPTION", c("Imports", "Suggests")) |> \
1515

1616
# setup cc()
1717
WORKDIR /root
18-
COPY .devcontainer/r-devel-gcc/.Rprofile .
18+
COPY .devcontainer/.Rprofile .

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
# v1.14.4 0.4826 0.5586 0.6586 0.6329 0.7348 1.318 100
203203
```
204204

205-
30. `rbind()` and `rbindlist()` now support `fill=TRUE` with `use.names=FALSE` instead of issuing the warning `use.names= cannot be FALSE when fill is TRUE. Setting use.names=TRUE.`, [#5444](https://github.com/Rdatatable/data.table/issues/5444). Thanks to @sindribaldur for testing dev and filing a bug report which was fixed before release.
205+
30. `rbind()` and `rbindlist()` now support `fill=TRUE` with `use.names=FALSE` instead of issuing the warning `use.names= cannot be FALSE when fill is TRUE. Setting use.names=TRUE.`, [#5444](https://github.com/Rdatatable/data.table/issues/5444). Thanks to @sindribaldur, @dcaseykc, @fox34, @adrian-quintario and @berg-michael for testing dev and filing a bug report which was fixed before release.
206206

207207
```R
208208
DT1

R/data.table.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ replace_dot_alias = function(e) {
180180
stopf("When by and keyby are both provided, keyby must be TRUE or FALSE")
181181
}
182182
if (missing(by)) { missingby=TRUE; by=bysub=NULL } # possible when env is used, PR#4304
183-
else if (verbose) catf("Argument '%s' after substitute: %s\n", "by", paste(deparse(bysub, width.cutoff=500L), collapse=" "))
183+
else if (verbose && !is.null(env)) catf("Argument '%s' after substitute: %s\n", "by", paste(deparse(bysub, width.cutoff=500L), collapse=" "))
184184
}
185185
bynull = !missingby && is.null(by) #3530
186186
byjoin = !is.null(by) && is.symbol(bysub) && bysub==".EACHI"
@@ -244,7 +244,7 @@ replace_dot_alias = function(e) {
244244
substitute2(.j, env),
245245
list(.j = substitute(j))
246246
))
247-
if (missing(jsub)) {j = substitute(); jsub=NULL} else if (verbose) catf("Argument '%s' after substitute: %s\n", "j", paste(deparse(jsub, width.cutoff=500L), collapse=" "))
247+
if (missing(jsub)) {j = substitute(); jsub=NULL} else if (verbose && !is.null(env)) catf("Argument '%s' after substitute: %s\n", "j", paste(deparse(jsub, width.cutoff=500L), collapse=" "))
248248
}
249249
}
250250
if (!missing(j)) {
@@ -332,7 +332,7 @@ replace_dot_alias = function(e) {
332332
substitute2(.i, env),
333333
list(.i = substitute(i))
334334
))
335-
if (missing(isub)) {i = substitute(); isub=NULL} else if (verbose) catf("Argument '%s' after substitute: %s\n", "i", paste(deparse(isub, width.cutoff=500L), collapse=" "))
335+
if (missing(isub)) {i = substitute(); isub=NULL} else if (verbose && !is.null(env)) catf("Argument '%s' after substitute: %s\n", "i", paste(deparse(isub, width.cutoff=500L), collapse=" "))
336336
}
337337
}
338338
if (!missing(i)) {

R/merge.R

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,20 @@ merge.data.table = function(x, y, by = NULL, by.x = NULL, by.y = NULL, all = FAL
9696
if (all.y && nrow(y)) { # If y does not have any rows, no need to proceed
9797
# Perhaps not very commonly used, so not a huge deal that the join is redone here.
9898
missingyidx = y[!x, which=TRUE, on=by, allow.cartesian=allow.cartesian]
99+
# TO DO: replace by following once #5446 is merged
100+
# if (length(missingyidx)) dt = rbind(dt, y[missingyidx], use.names=FALSE, fill=TRUE, ignore.attr=TRUE)
99101
if (length(missingyidx)) {
100-
dt = rbind(dt, y[missingyidx], use.names=FALSE, fill=TRUE)
102+
yy = y[missingyidx]
103+
othercolsx = setdiff(nm_x, by)
104+
if (length(othercolsx)) {
105+
# create NA rectangle with correct types and attributes of x to cbind to y
106+
tmp = rep.int(NA_integer_, length(missingyidx))
107+
# TO DO: use set() here instead..
108+
yy = cbind(yy, x[tmp, othercolsx, with = FALSE])
109+
}
110+
# empty data.tables (nrow =0, ncol>0) doesn't skip names anymore in new rbindlist
111+
# takes care of #24 without having to save names. This is how it should be, IMHO.
112+
dt = rbind(dt, yy, use.names=FALSE)
101113
}
102114
}
103115
# X[Y] syntax puts JIS i columns at the end, merge likes them alongside i.

inst/tests/tests.Rraw

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,6 +1919,11 @@ test(631.5, DT3, data.table(a=c(2), total=c(5), key="a"))
19191919
# .. nrow(y)=1, i subset y with 1 and match with x
19201920
test(631.6, merge(DT1,DT4,all.y=TRUE), data.table(a=c(3),total.x=c(1),total.y=c(1),key="a"))
19211921
test(631.7, DT4, data.table(a=c(3), total=c(1), key="a"))
1922+
# merge columns with different attributes #5309
1923+
x = data.table(a=1L, b=as.IDate(16801))
1924+
y = data.table(a=2L, b=NA)
1925+
test(631.8, merge(x,y,by="a",all=TRUE), data.table(a=c(1L,2L), b.x=as.IDate(c(16801,NA)), b.y=NA, key="a"))
1926+
test(631.9, merge(y,x,by="a",all=TRUE), data.table(a=c(1L,2L), b.x=NA, b.y=as.IDate(c(16801,NA)), key="a"))
19221927

19231928
test(632, merge(DT1,DT2,all=TRUE), data.table(a=c(1,2,3,4,5),total.x=c(2,NA,1,3,1),total.y=c(NA,5,1,NA,2),key="a"))
19241929
test(632.1, merge(DT1,DT2,all=TRUE), setkey(adt(merge(adf(DT1),adf(DT2),by="a",all=TRUE)),a))
@@ -14335,6 +14340,14 @@ test(2003.5, rbindlist(list(data.table(a=1:2), data.table(b=3:4, c=5:6)), fill=T
1433514340
# rbindlist segfault with fill=TRUE and usenames=FALSE #5444
1433614341
test(2003.6, rbindlist(list(list(1), list(2,3)), fill=TRUE, use.names=FALSE), data.table(c(1,2), c(NA, 3)))
1433714342
test(2003.7, rbindlist(list(list(1), list(2,factor(3))), fill=TRUE, use.names=FALSE), data.table(c(1,2), factor(c(NA, 3))))
14343+
# rbind with different attributes #5309
14344+
x=data.table(a=as.Date(NA))
14345+
y=data.table(a=as.Date('2021-10-05'), b=as.POSIXct("2021-10-06 13:58:00 UTC"))
14346+
ans=data.table(a=as.Date(c(NA_character_, '2021-10-05')), b=as.POSIXct(c(NA_character_, "2021-10-06 13:58:00 UTC")))
14347+
test(2003.81, rbind(x, y, fill=TRUE, use.names=TRUE), ans)
14348+
test(2003.82, rbind(y, x, fill=TRUE, use.names=TRUE), ans[2:1,])
14349+
test(2003.83, rbind(x, y, fill=TRUE, use.names=FALSE), ans)
14350+
test(2003.84, rbind(y, x, fill=TRUE, use.names=FALSE), ans[2:1,])
1433814351

1433914352
# chmatch coverage for two different non-ascii encodings matching; issues mentioned in comments in chmatch.c #69 #2538 #111
1434014353
x1 = "fa\xE7ile"

0 commit comments

Comments
 (0)