Skip to content

Commit 118d6e1

Browse files
Merge branch 'issue_1916' of https://github.com/Rdatatable/data.table into issue_1916
2 parents 4098c0c + d42f1b3 commit 118d6e1

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

R/as.data.table.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ as.data.table.list = function(x,
146146
if (is.null(xi)) next # eachncol already initialized to 0 by integer() above
147147
if (check_rownames && is.null(rownames_)) {
148148
if (is.null(dim(xi))) {
149-
if (!is.null(nm <- names(xi)) && any(nzchar(nm))) {
149+
if (!is.null(nm <- names(xi))) {
150150
rownames_ = nm
151151
x[[i]] = unname(xi)
152152
}
153153
} else {
154-
if (!is.null(nm <- rownames(xi)) && any(nzchar(nm))) {
154+
if (!is.null(nm <- rownames(xi))) {
155155
rownames_ = nm
156156
}
157157
}

inst/tests/tests.Rraw

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21418,10 +21418,5 @@ test(2330.3, as.data.table(list(y, x), keep.rownames=TRUE), data.table(rn=c("A",
2141821418
test(2330.4, as.data.table(data.frame(x, y), keep.rownames=TRUE), data.table(rn=c("A", "B", "C"), x=1:3, y=4:6))
2141921419
test(2330.5, as.data.table(data.frame(y, x), keep.rownames=TRUE), data.table(rn=c("A", "B", "C"), y=4:6, x=1:3))
2142021420

21421-
a <- setNames(7:9, c("", "", "")) # test condition about any(nzchar(valid_names))
21422-
test(2330.6, as.data.table(list(a), keep.rownames=TRUE), data.table(V1=7:9))
21423-
b <- setNames(10:12, c("", "B", ""))
21424-
test(2330.7, as.data.table(list(b), keep.rownames=TRUE), data.table(rn=c("", "B", ""), V1=10:12))
21425-
2142621421
DF <- data.frame(row.names = letters[1:6], V = 1:6) # Test data.frame with explicit rownames
21427-
test(2330.8, as.data.table(list(a = 6:1, DF), keep.rownames=TRUE), data.table(rn=letters[1:6], a=6:1, V=1:6))
21422+
test(2330.6, as.data.table(list(a = 6:1, DF), keep.rownames=TRUE), data.table(rn=letters[1:6], a=6:1, V=1:6))

0 commit comments

Comments
 (0)