Closed prescient closed 4 years ago
I'll close my particular issue as I figured out a minimal example using standard evaluation. NSE is still a bit of a mystery to me.
require(rqdatatable)
require(rquery)
cols <- c("mpg", "cyl", "hp")
denom <- c("wt")
col_labels <- paste0(cols, "_per_", denom)
mtcars %.>%
extend_se(.,
col_labels %:=% paste0(cols, "/", denom))
Actually you solved it the right way. NSE
is a bad idea if taken too far. To my tastes standard evaluation is actually the right way to approach this sort of problem. Either way thanks for your note!
I appreciate your work on the package. Its good stuff!
Thanks, I am actually taking your advice and adding a small vignette.
Appreciate it. I've tried to perform similar paramterization with dplyr and could never figure it out (usually only one variable), and pure data.table is workable but controlling column names is a bit more confusing than it should be imo. This is the only package I've ever got working for this sort of stuff so I really appreciate it as it helps avoid boilerplate (currently staring at 200+ lines of boilerplate sql...).
Wow, it is great to hear from a happy user. I use rquery
for my own work, and it has for me paid back its development time. Here is my current draft of a many columns vignette.
I just read the vignette and it is exactly what I was looking for. Thanks!
Would it be possible to add a small tutorial on parameterizing rquery to perform transformations on multiple columns? Something similar to: https://cran.r-project.org/web/packages/rquery/vignettes/Parameterized_rquery.html but performing transformations on more than one column at a time. I thought I had figured this out at one point, but apparently forgot. If the documentation exists somewhere my apologies.