Skip to content

Commit 8397dc3

Browse files
committed
Removes unnecessary data.table call from as.data.table.array
1 parent 73d79ed commit 8397dc3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/as.data.table.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ as.data.table.array = function(x, keep.rownames=FALSE, key=NULL, sorted=TRUE, va
107107
if (value.name %chin% names(val))
108108
stopf("Argument 'value.name' should not overlap with column names in result: %s", brackify(rev(names(val))))
109109
N = NULL
110-
ans = data.table(do.call(CJ, c(val, sorted=FALSE)), N=as.vector(x))
110+
ans = do.call(CJ, c(val, sorted=FALSE))
111+
set(ans, j = "N", value = as.vector(x))
111112
if (isTRUE(na.rm))
112113
ans = ans[!is.na(N)]
113114
setnames(ans, "N", value.name)

0 commit comments

Comments
 (0)