Skip to content

Commit 4b58a7a

Browse files
Put cols=NULL default into the signature to avoid missing() quirks
1 parent 8b5027e commit 4b58a7a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

R/mergelist.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ mergelist_impl_ = function(l, on, cols, how, mult, copy) {
299299
if (length(how)!=n-1L || !all(vapply_1b(how, function(x) is.character(x) && length(x)==1L && !anyNA(x) && x %chin% c("left", "inner", "full", "right", "semi", "anti", "cross"))))
300300
stopf("'how' must be one of [left, inner, full, right, semi, anti, cross], or a list of such whose length must be length(l)-1L")
301301

302-
if (missing(cols) || is.null(cols)) {
302+
if (is.null(cols)) {
303303
cols = vector("list", n)
304304
} else {
305305
if (!is.list(cols))
@@ -346,12 +346,12 @@ mergelist_impl_ = function(l, on, cols, how, mult, copy) {
346346
out
347347
}
348348

349-
mergelist = function(l, on, cols, how=c("left", "inner", "full", "right", "semi", "anti", "cross"), mult, join.many=getOption("datatable.join.many")) {
349+
mergelist = function(l, on, cols=NULL, how=c("left", "inner", "full", "right", "semi", "anti", "cross"), mult, join.many=getOption("datatable.join.many")) {
350350
if (missing(how) || is.null(how))
351351
how = match.arg(how)
352352
mergelist_impl_(l, on, cols, how, mult, join.many, copy=TRUE)
353353
}
354-
setmergelist = function(l, on, cols, how=c("left", "inner", "full", "right", "semi", "anti", "cross"), mult, join.many=getOption("datatable.join.many")) {
354+
setmergelist = function(l, on, cols=NULL, how=c("left", "inner", "full", "right", "semi", "anti", "cross"), mult, join.many=getOption("datatable.join.many")) {
355355
if (missing(how) || is.null(how))
356356
how = match.arg(how)
357357
mergelist_impl_(l, on, cols, how, mult, join.many, copy=FALSE)

man/mergelist.Rd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
Faster merge of multiple \code{data.table}s.
77
}
88
\usage{
9-
mergelist(l, on, cols,
9+
mergelist(l, on, cols=NULL,
1010
how=c("left", "inner", "full", "right", "semi", "anti", "cross"),
1111
mult, join.many=getOption("datatable.join.many"))
12-
setmergelist(l, on, cols,
12+
setmergelist(l, on, cols=NULL,
1313
how=c("left", "inner", "full", "right", "semi", "anti", "cross"),
1414
mult, join.many=getOption("datatable.join.many"))
1515
}
1616
\arguments{
1717
\item{l}{ \code{list} of \code{data.table}s to merge. }
18-
\item{on}{ \code{character} vector of column names to merge on; when missing, the \emph{key} of \emph{join-to} table is used. }
19-
\item{cols}{ \code{list} of \code{character} column names corresponding to tables in \code{l}, used to subset columns during merges. }
18+
\item{on}{ \code{character} vector of column names to merge on; when missing, the \code{\link{key}} of the \emph{join-to} table is used (see Details). }
19+
\item{cols}{ Optional \code{list} of \code{character} column names corresponding to tables in \code{l}, used to subset columns during merges. }
2020
\item{how}{ \code{character} scalar, controls how to merge tables. Allowed values are \code{"left"} (default), \code{"inner"}, \code{"full"}, \code{"right"}, \code{"semi"}, \code{"anti"}, \code{"cross"}. See Details. }
2121
\item{mult}{ \code{character} scalar, controls how to proceed when multiple rows in \emph{join-to} table match to the row in \emph{join-from} table. Allowed values are \code{"error"}, \code{"all"}, \code{"first"}, \code{"last"}. Default depends on \code{how}, described in \emph{details} below. See examples on how to detect duplicated matches. Using \code{"all"} is recommended together with \code{join.many=FALSE}, unless rows explosion or cartesian product are intended. }
2222
\item{join.many}{ \code{logical}, defaults to \code{getOption("datatable.join.many")}, which is \code{TRUE} by default; when \code{FALSE} and \code{mult="all"}, then extra check is made to ensure no \emph{many-to-many} matches exist between tables, and if they exist, then exception is raised. Works similarly to \code{allow.cartesian} option in \code{[.data.table} but is more strict. An option \code{"datatable.join.many"} controls that globally for \code{mergelist} and \code{[.data.table}. }

0 commit comments

Comments
 (0)