Skip to content

Instantly share code, notes, and snippets.

@gadenbuie
Last active May 22, 2019 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gadenbuie/64f3f563fd4affab14de1958735b6e61 to your computer and use it in GitHub Desktop.
Save gadenbuie/64f3f563fd4affab14de1958735b6e61 to your computer and use it in GitHub Desktop.
library(rlang)
enexpr_first <- function(x, aggr_func) {
browser()
func <- enexpr(aggr_func)
x <- aggr_func(x)
list(x = x, f = func)
}
enexpr_second <- function(x, aggr_func) {
browser()
x <- aggr_func(x)
func <- enexpr(aggr_func)
list(x = x, f = func)
}
@Chris-Engelhardt
Copy link

Do you think it makes sense to update the f objects (lines 7, 8, 14, and 15) with something other than f? If using browser() mode, inspecting the f object terminates the browsing session.

@gadenbuie
Copy link
Author

Thanks @Chris-Engelhardt, I didn't know about f being a browser() mode keyword (cool TIL!)

@Chris-Engelhardt
Copy link

I didn't either, @gadenbuie, until I tried stepping through your function in browser() mode. Thanks also for teaching me about purrr::partial()!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment