Skip to content

Commit 9ce6737

Browse files
committed
vapply on single columns instead of whole subset
1 parent f45564a commit 9ce6737

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/data.table.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,7 @@ replace_dot_alias = function(e) {
13241324
## check key on i as well!
13251325
ichk = is.data.table(i) && haskey(i) &&
13261326
identical(head(key(i), length(leftcols)), names_i[leftcols]) # i has the correct key, #3061
1327+
dt_types = function(x, cols = seq_along(x)) vapply_1c(cols, function(j) typeof(x[[j]]))
13271328
if (
13281329
keylen
13291330
&& (
@@ -1333,7 +1334,7 @@ replace_dot_alias = function(e) {
13331334
.Call(CisOrderedSubset, irows, nrow(x))
13341335
&& (!roll || length(irows) == 1L) # see #1010. don't set key when i has no key, but irows is ordered and roll != FALSE
13351336
&& ( #5361 merging on keyed factor with character, check if resulting character is really sorted
1336-
identical(vapply_1c(i[,leftcols,with=FALSE], typeof), vapply_1c(x[,rightcols,with=FALSE], typeof)) # can only be not identical
1337+
identical(dt_types(i, leftcols), dt_types(x, rightcols)) # can only be not identical
13371338
|| is.sorted(ans, by=head(key(x), keylen))
13381339
)
13391340
)

0 commit comments

Comments
 (0)