You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
limit=if (!is.null(anyDups) &&anyDups) { # #742. If 'i' has no duplicates, ignore
530
-
if (!join.many) stop("Joining resulted in many-to-many join. Perform quality check on your data, use mult!='all', or set 'datatable.join.many' option to TRUE to allow rows explosion.")
530
+
if (!join.many) stopf("Joining resulted in many-to-many join. Perform quality check on your data, use mult!='all', or set 'datatable.join.many' option to TRUE to allow rows explosion.")
elsestop("internal error: checking allow.cartesian and join.many, unexpected else branch reached, please report to issue tracker") # nocov
532
+
elseinternal_error("checking allow.cartesian and join.many, unexpected else branch reached") # nocov
533
533
}
534
534
vecseq(f__, len__, limit)
535
535
} # rows in i might not match to x so old max(nrow(x),nrow(i)) wasn't enough. But this limit now only applies when there are duplicates present so the reason now for nrow(x)+nrow(i) is just to nail it down and be bigger than max(nrow(x),nrow(i)).
@@ -103,7 +103,7 @@ dtmerge = function(x, i, on, how, mult, join.many, void=FALSE, verbose) {
103
103
!(length(ans$starts)==1L&&ans$lens==nrow(x)) &&## special case of scalar i match to const duplicated x, not handled by anyDuplicate: data.table(x=c(1L,1L))[data.table(x=1L), on="x"]
stop("Joining resulted in many-to-many join. Perform quality check on your data, use mult!='all', or set 'datatable.join.many' option to TRUE to allow rows explosion.")
106
+
stopf("Joining resulted in many-to-many join. Perform quality check on your data, use mult!='all', or set 'datatable.join.many' option to TRUE to allow rows explosion.")
107
107
}
108
108
109
109
## xrows, join-to
@@ -120,7 +120,7 @@ dtmerge = function(x, i, on, how, mult, join.many, void=FALSE, verbose) {
120
120
len.x= length(xrows)
121
121
122
122
if (len.i!=len.x)
123
-
stop("internal error: dtmerge out len.i != len.x") # nocov
123
+
internal_error("dtmerge out len.i != len.x") # nocov
stop("'on' is missing and necessary key is not present")
139
+
stopf("'on' is missing and necessary key is not present")
140
140
}
141
141
if (any(bad.on<-!on %chin% names(lhs)))
142
-
stop(sprintf("'on' argument specify columns to join [%s] that are not present in LHS table [%s]", paste(on[bad.on], collapse=", "), paste(names(lhs), collapse=", ")))
142
+
stopf("'on' argument specify columns to join [%s] that are not present in LHS table [%s]", brackify(on[bad.on]), brackify(names(lhs)))
143
143
if (any(bad.on<-!on %chin% names(rhs)))
144
-
stop(sprintf("'on' argument specify columns to join [%s] that are not present in RHS table [%s]", paste(on[bad.on], collapse=", "), paste(names(rhs), collapse=", ")))
144
+
stopf("'on' argument specify columns to join [%s] that are not present in RHS table [%s]", brackify(on[bad.on]), brackify(names(rhs)))
out.x=if (is.null(ans$xrows)) ## as of now xrows cannot be NULL #4409 thus nocov below
181
-
stop("internal error: dtmerge()$xrows returned NULL, #4409 been resolved but related code has not been updated? please report to issue tracker") #.shallow(jnto, cols=someCols(jnto, to.cols, drop=on), retain.key=TRUE) # nocov ## as of now nocov does not make difference r-lib/covr#279
181
+
internal_error("dtmerge()$xrows returned NULL, #4409 been resolved but related code has not been updated?") #.shallow(jnto, cols=someCols(jnto, to.cols, drop=on), retain.key=TRUE) # nocov ## as of now nocov does not make difference r-lib/covr#279
## ensure no duplicated column names in merge results
186
186
if (any(dup.i<-names(out.i) %chin% names(out.x)))
187
-
stop("merge result has duplicated column names, use 'cols' argument or rename columns in 'l' tables, duplicated column(s): ", paste(names(out.i)[dup.i], collapse=", "))
187
+
stopf("merge result has duplicated column names, use 'cols' argument or rename columns in 'l' tables, duplicated column(s): %s", brackify(names(out.i)[dup.i]))
188
188
}
189
189
190
190
## stack i and x
@@ -241,16 +241,16 @@ mergelist = function(l, on, cols, how=c("left","inner","full","right","semi","an
241
241
p= proc.time()[[3L]]
242
242
{
243
243
if (!is.list(l) || is.data.frame(l))
244
-
stop("'l' must be a list")
244
+
stopf("'l' must be a list")
245
245
if (any(!vapply(l, is.data.table, FALSE)))
246
-
stop("Every element of 'l' list must be data.table objects")
246
+
stopf("Every element of 'l' list must be data.table objects")
247
247
if (any(!vapply(l, length, 0L)))
248
-
stop("Tables in 'l' argument must be non-zero columns tables")
248
+
stopf("Tables in 'l' argument must be non-zero columns tables")
249
249
if (any(vapply(l, function(x) anyDuplicated(names(x)), 0L)))
250
-
stop("Some of the tables in 'l' have duplicated column names")
250
+
stopf("Some of the tables in 'l' have duplicated column names")
251
251
} ## l
252
252
if (!isTRUEorFALSE(copy))
253
-
stop("'copy' must be TRUE or FALSE")
253
+
stopf("'%s' must be TRUE or FALSE", "copy")
254
254
n= length(l)
255
255
if (n<2L) {
256
256
out=if (!n) as.data.table(l) elsel[[1L]]
@@ -263,37 +263,37 @@ mergelist = function(l, on, cols, how=c("left","inner","full","right","semi","an
263
263
if (!is.list(join.many))
264
264
join.many= rep(list(join.many), n-1L)
265
265
if (length(join.many)!=n-1L|| any(!vapply(join.many, isTRUEorFALSE, NA)))
266
-
stop("'join.many' must be TRUE or FALSE, or a list of such which length must be length(l)-1L")
266
+
stopf("'join.many' must be TRUE or FALSE, or a list of such which length must be length(l)-1L")
0 commit comments