Does replyr::let work with data.table?

December 24, 2016

(This article was first published on R – Win-Vector Blog, and kindly contributed to R-bloggers)

I’ve been asked if the adapter “let” from our R package replyr works with data.table.

My answer is: it does work. I am not a data.table user so I am not the one to ask if data.table benefits a from a non-standard evaluation to standard evaluation adapter such as replyr::let.

Using replyr::let with data.table looks like the following:


data("iris", package= "datasets")
iris.dt <- data.table(iris)

# non-standard evaluation, column names hard-coded
iris.dt[, mean(Sepal.Length), by=Species]

# standard evaluation, column names parameterized
    list(GROUPCOL='Species', DATACOL='Sepal.Length'),
    iris.dt[, mean(DATACOL), by=GROUPCOL]

I’ve generated some timings to show there is some overhead in the translation (especially on trivial examples):

Pressure 1

If any data.table users want to comment if this is useful or not, I’d be happy to hear from you.

To leave a comment for the author, please follow the link and comment on their blog: R – Win-Vector Blog. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)