Skip to content

Commit

Permalink
List checks proceed in setDT if type list
Browse files Browse the repository at this point in the history
Prevents avoiding of these checks by assigning "data.table" or "data.frame" class to a list.
  • Loading branch information
sritchie73 committed Jan 15, 2020
1 parent c005296 commit 59f0bfe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down

0 comments on commit 59f0bfe

Please sign in to comment.