diff --git a/R/data.table.R b/R/data.table.R index af4f14de0..e3dfea13e 100644 --- a/R/data.table.R +++ b/R/data.table.R @@ -2703,7 +2703,8 @@ setDT = function(x, keep.rownames=FALSE, key=NULL, check.names=FALSE) { x[, (nm[1L]) := rn] setcolorder(x, nm) } - } else if (is.list(x) && length(x)==1L && is.matrix(x[[1L]])) { + } + if (is.list(x) && length(x)==1L && is.matrix(x[[1L]])) { # a single list(matrix) is unambiguous and depended on by some revdeps, #3581 x = as.data.table.matrix(x[[1L]]) } else if (is.null(x) || (is.list(x) && !length(x))) {