File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -144,20 +144,15 @@ as.data.table.list = function(x,
144144 for (i in seq_len(n )) {
145145 xi = x [[i ]]
146146 if (is.null(xi )) next # eachncol already initialized to 0 by integer() above
147- if (check_rownames && is.null(vector_rownames )) {
148- # Check for named vectors
149- if (is.atomic(xi ) && ! is.null(names(xi )) && is.null(dim(xi ))) {
150- valid_names = names(xi )
151- if (any(nzchar(valid_names ))) {
152- vector_rownames = valid_names
147+ if (check_rownames && is.null(vector_rownames ) && is.atomic(xi )) {
148+ if (is.null(dim(xi ))) {
149+ if (! is.null(nm <- names(xi )) && any(nzchar(nm ))) {
150+ vector_rownames = nm
153151 x [[i ]] = unname(xi )
154152 }
155- }
156- # Check for data.frames or matrices with explicit rownames
157- else if (! is.null(dim(xi )) && ! is.null(rownames(xi ))) {
158- valid_names = rownames(xi )
159- if (any(nzchar(valid_names ))) {
160- vector_rownames = valid_names
153+ } else {
154+ if (! is.null(nm <- rownames(xi )) && any(nzchar(nm ))) {
155+ vector_rownames = nm
161156 }
162157 }
163158 }
You can’t perform that action at this time.
0 commit comments