Description Usage Arguments Details Examples
Inspired by magrittr::`%>%`
, allows one to use data.table syntax on
a non data.table data frame and return an object of the same class as the
input. It is especially useful when used in a in a magrittr / tidyverse
pipe chain.
1 | lhs %DT>% rhs
|
lhs |
A data.frame |
rhs |
A data.table call starting with "." |
Unlike with magrittr only the first dot is subtituted, so .()
can still
be used in the call.
%DT>%
is more efficient than withDT
, their use cases overlap but they
are different in that %DT>%
will allow data.table syntax on a single
table while an expression fed to withDT()
can contain several data frames
that we all be treated as data.table objects.
1 2 3 4 5 6 7 8 9 | ## Not run:
library(tidyverse)
iris %>%
as_tibble() %DT>%
.[, .(meanSW = mean(Sepal.Width)), by = Species][
,Species := as.character(Species)] %>%
filter(startsWith(Species,"v"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.