You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Slow="73d79edf8ff8c55163e90631072192301056e336", # Parent of the first commit in the PR (https://github.com/Rdatatable/data.table/commit/8397dc3c993b61a07a81c786ca68c22bc589befc)
278
278
Fast="8397dc3c993b61a07a81c786ca68c22bc589befc"), # Commit in the PR (https://github.com/Rdatatable/data.table/pull/7019/commits) that removes inefficiency
279
279
280
+
"isoweek improved in #7144"=atime::atime_test(
281
+
setup= {
282
+
set.seed(349)
283
+
x= sample(Sys.Date() -0:5000, N, replace=TRUE)
284
+
},
285
+
expr=data.table::isoweek(x),
286
+
Slow="548410d23dd74b625e8ea9aeb1a5d2e9dddd2927", # Parent of the first commit in the PR (https://github.com/Rdatatable/data.table/commit/548410d23dd74b625e8ea9aeb1a5d2e9dddd2927)
287
+
Fast="c0b32a60466bed0e63420ec105bc75c34590865e"), # Commit in the PR (https://github.com/Rdatatable/data.table/pull/7144/commits) that uses a much faster implementation
origListNames=if (missing(.named)) names(x) elseNULL# as.data.table called directly, not from inside data.table() which provides .named, #3854
135
138
empty_atomic=FALSE
139
+
140
+
# Handle keep.rownames for vectors (mimicking data.frame behavior)
141
+
rownames_=NULL
142
+
check_rownames=!isFALSE(keep.rownames)
143
+
136
144
for (iin seq_len(n)) {
137
145
xi=x[[i]]
138
146
if (is.null(xi)) next# eachncol already initialized to 0 by integer() above
147
+
if (check_rownames&& is.null(rownames_)) {
148
+
if (is.null(dim(xi))) {
149
+
if (!is.null(nm<- names(xi))) {
150
+
rownames_=nm
151
+
x[[i]] = unname(xi)
152
+
}
153
+
} else {
154
+
if (!is.null(nm<- rownames(xi))) {
155
+
rownames_=nm
156
+
}
157
+
}
158
+
}
139
159
if (!is.null(dim(xi)) &&missing.check.names) check.names=TRUE
140
160
if ("POSIXlt" %chin% class(xi)) {
141
161
warningf("POSIXlt column type detected and converted to POSIXct. We do not recommend use of POSIXlt at all because it uses 40 bytes to store one date.")
Copy file name to clipboardExpand all lines: man/as.data.table.Rd
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ is.data.table(x)
31
31
}
32
32
\arguments{
33
33
\item{x}{AnRobject.}
34
-
\item{keep.rownames}{Defaultis \code{FALSE}.If \code{TRUE}, addstheinputobject's names as a separate column named \code{"rn"}. \code{keep.rownames = "id"} names the column \code{"id"} instead.}
34
+
\item{keep.rownames}{Defaultis \code{FALSE}.If \code{TRUE}, addstheinputobject's names as a separate column named \code{"rn"}. \code{keep.rownames = "id"} names the column \code{"id"} instead. For lists and when calling \code{data.table()}, names from the first named vector are extracted and used as row names, similar to \code{data.frame()} behavior.}
35
35
\item{key}{ Character vector of one or more column names which is passed to \code{\link{setkeyv}}. }
36
36
\item{sorted}{logical used in \emph{array} method, default \code{TRUE} is overridden when \code{key} is provided. }
37
37
\item{value.name}{character scalar used in \emph{array} method, default \code{"value"}.}
0 commit comments