Skip to content

Commit 7463633

Browse files
authored
Update data.table.R
1 parent cacdc92 commit 7463633

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/data.table.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,11 @@ replace_dot_alias = function(e) {
13361336

13371337
if (is.data.table(jval)) {
13381338
setattr(jval, 'class', class(x)) # fix for #64
1339-
if (haskey(x) && all(key(x) %chin% names(jval)) && suppressWarnings(is.sorted(jval, by=key(x)))) # TO DO: perhaps this usage of is.sorted should be allowed internally then (tidy up and make efficient)
1339+
if (haskey(x) &&
1340+
all(key(x) == names(jval)) && ## order of names should matter for the key; %chin% wouldn't care about order!
1341+
((is.null(irows) && jsub %iscall% "list" && all(vapply_1b(as.list(jsub)[-1L], is.name))) || ##fix for #4498
1342+
suppressWarnings(is.sorted(jval, by=key(x))))
1343+
) # TO DO: perhaps this usage of is.sorted should be allowed internally then (tidy up and make efficient)
13401344
setattr(jval, 'sorted', key(x))
13411345
if (any(sapply(jval, is.null))) stop("Internal error: j has created a data.table result containing a NULL column") # nocov
13421346
}

0 commit comments

Comments
 (0)