Skip to content

Commit b52fef8

Browse files
committed
corrected lint-r
1 parent 4e41b00 commit b52fef8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

R/merge.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ merge.data.table = function(x, y, by = NULL, by.x = NULL, by.y = NULL, all = FAL
22
all.y = all, sort = TRUE, suffixes = c(".x", ".y"), no.dups = TRUE,
33
allow.cartesian = getOption("datatable.allow.cartesian"),
44
incomparables = NULL, ...) {
5+
# Error handling for logical arguments
56
if (!is.logical(sort)) stopf("Argument 'sort' should be logical TRUE/FALSE")
67
if (!is.logical(no.dups)) stopf("Argument 'no.dups' should be logical TRUE/FALSE")
78

9+
# Convert y to data.table if not already
810
class_x = class(x)
911
if (!is.data.table(y)) {
1012
y = as.data.table(y)
@@ -13,6 +15,7 @@ merge.data.table = function(x, y, by = NULL, by.x = NULL, by.y = NULL, all = FAL
1315
}
1416
}
1517

18+
# Handle case when either x or y is empty
1619
x0 = length(x) == 0L
1720
y0 = length(y) == 0L
1821

0 commit comments

Comments
 (0)