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
Copy file name to clipboardExpand all lines: NEWS.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,12 @@
109
109
110
110
21.`melt()`waspseudogenericinthat`melt(DT)`woulddispatchtothe`melt.data.table`methodbut`melt(not-DT)`wouldexplicitlyredirectto`reshape2`.Now`melt()`isstandardgenericsothatmethodscanbedevelopedinotherpackages, [#4864](https://github.com/Rdatatable/data.table/pull/4864). Thanks to @odelmarcelle for suggesting and implementing.
111
111
112
+
22.`DT(i, j, by, ...)`hasbeenadded, i.e.functionalformofa`data.table`query, [#641](https://github.com/Rdatatable/data.table/issues/641) [#4872](https://github.com/Rdatatable/data.table/issues/4872). Thanks to Yike Lu and Elio Campitelli for filing requests, many others for comments and suggestions, and Matt Dowle for the PR. This enables the `data.table` general form query to be invoked on a `data.frame` without converting it to a `data.table` first. The class of the input object is retained.
113
+
114
+
```R
115
+
mtcars|> DT(mpg>20, .(mean_hp=mean(hp)), by=cyl)
116
+
```
117
+
112
118
## BUG FIXES
113
119
114
120
1.`by=.EACHI`when`i`iskeyedbut`on=`differentcolumnsthan`i`'s key could create an invalidly keyed result, [#4603](https://github.com/Rdatatable/data.table/issues/4603) [#4911](https://github.com/Rdatatable/data.table/issues/4911). Thanks to @myoung3 and @adamaltmejd for reporting, and @ColeMiller1 for the PR. An invalid key is where a `data.table` is marked as sorted by the key columns but the data is not sorted by those columns, leading to incorrect results from subsequent queries.
Copy file name to clipboardExpand all lines: man/data.table.Rd
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@
5
5
\alias{Ops.data.table}
6
6
\alias{is.na.data.table}
7
7
\alias{[.data.table}
8
+
\alias{DT}
8
9
\alias{.}
9
10
\alias{.(}
10
11
\alias{.()}
@@ -217,6 +218,8 @@ The way to read this out loud is: "Take \code{DT}, subset rows by \code{i}, \emp
217
218
# see ?assign to add/update/delete columns by reference using the same consistent interface
218
219
}
219
220
221
+
A \code{data.table} query may be invoked on a \code{data.frame} using functional form \code{DT(...)}, see examples. The class of the input is retained.
222
+
220
223
A \code{data.table} is a \code{list} of vectors, just like a \code{data.frame}. However :
221
224
\enumerate{
222
225
\item it never has or uses rownames. Rownames based indexing can be done by setting a \emph{key} of one or more columns or done \emph{ad-hoc} using the \code{on} argument (now preferred).
@@ -431,6 +434,11 @@ dev.off()
431
434
# using rleid, get max(y) and min of all cols in .SDcols for each consecutive run of 'v'
0 commit comments