March 16, 2019

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

I would like to once again recommend our readers to our note on wrapr::let(), an R function that can help you eliminate many problematic NSE (non-standard evaluation) interfaces (and their associate problems) from your R programming tasks.

The idea is to imitate the following lambda-calculus idea:

let x be y in z := ( λ x . z ) y

The above reads as: “let x be y in z” is taken to mean “evaluate the expression z, with the value y substituted in for any instances of x in the expression z.” Notationally: λ builds a function evaluating the expression z with x as a parameter, and the right-placement of y denotes evaluating this function with the argument x set to the value referred to by y.

Now R isn’t the lambda-calculus (and doesn’t have a full-power macro system), so there are a number of details one needs to get right about code quoting/capture and what environment things are evaluated in. wrapr::let() has tools for this, and these tools are documented with examples in the note.

We think wrapr::let() is a good solution (and remains better than some of the systems that come after it; we’ve been attempting to collect notes on prior art and posterior art here, as citing prior art was at one time the standard of discourse).

To leave a comment for the author, please follow the link and comment on their blog: R – Win-Vector Blog.

R-bloggers.com 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

Recent popular posts


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)