We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4cf9a70 commit f2c7f32Copy full SHA for f2c7f32
R/as.data.table.R
@@ -48,6 +48,8 @@ as.data.table.matrix = function(x, keep.rownames=FALSE, key=NULL, ...) {
48
if (!identical(keep.rownames, FALSE)) {
49
# can specify col name to keep.rownames, #575
50
ans = data.table(rn=rownames(x), x, keep.rownames=FALSE)
51
+ if (ncol(x) == 1L && !isTRUE(colnames(x) == "x"))
52
+ setnames(ans, 'x', 'V1')
53
if (is.character(keep.rownames))
54
setnames(ans, 'rn', keep.rownames[1L])
55
return(ans)
0 commit comments