plot_hist = function(df, column){
quoCol= enquo(column)
hist(pull(df, !!quoCol))
}
plot_hist(iris, Petal.Width) ## works as expected
# here another method that internally should call plot_hist:
do_stuff = function (df, column){
plot_hist(df, column)
# ... more stuff
}
do_stuff(iris, Petal.Width) ## does not work but fails with
Error in overscope_eval_next(overscope, expr) :
object 'Petal.Width' not found
plot_hist should stay as it is, but do_stuff needs to be changed somehow, I guess.
What am I doing wrong here?
Thanks,
best regards,
Holger
--
You received this message because you are subscribed to the Google Groups "manipulatr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to manipulatr+unsubscribe@googlegroups.com.
To post to this group, send email to manip...@googlegroups.com.
Visit this group at https://groups.google.com/group/manipulatr.
For more options, visit https://groups.google.com/d/optout.
do_stuff() needs to enquo() and then unquote when calling plot_hist(). (Quasiquotation is sort of infectious)HadleyHi,--I'd like to pass on a bare column name to another method:plot_hist = function(df, column){
quoCol= enquo(column)
hist(pull(df, !!quoCol))
}
plot_hist(iris, Petal.Width) ## works as expected
# here another method that internally should call plot_hist:
do_stuff = function (df, column){
plot_hist(df, column)
# ... more stuff
}
do_stuff(iris, Petal.Width) ## does not work but fails withError in overscope_eval_next(overscope, expr) :
object 'Petal.Width' not found
plot_hist should stay as it is, but do_stuff needs to be changed somehow, I guess.What am I doing wrong here?Thanks,best regards,Holger
You received this message because you are subscribed to the Google Groups "manipulatr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to manipulatr+...@googlegroups.com.