use package without calling library(wakefield)
Thanks for making this useful package.
I tried to use it initially by doing:
wakefield::r_data_frame(id, age, n = 500)
This fails because, it seems, the id and age, etc, functions need to be available. It is beyond my knowledge, but perhaps you could interpret the symbols given in the wakefield namespace. Adding all those generic-sounding names to my namespace is a little worrying. I suppose I can call each function directly, using wakefield:: but this becomes more cumbersome. Just a thought.
+1 to be able to use this without the package being loaded. e.g.
wakefield::r_data_theme(n = 100)
doesn't work without the package being loaded.
Would be great if this could work.
@jackwasey This is a very generalizable problem. Nowadays many people prefer not to risk polluting their global search path.
- One of the solutions could be manipulating enclosing chain of environments of the
r_data_framefunction, injecting bindings from the package's namespace such asidandagein a parent environment. - The other is to modify the
r_data_framefunction itself so that it always evaluate the symbols in the package's own namespace.
@iqis any interest in a pull request?
@trinker
I'm actually not able to reproduce the issue with wakefield::r_data_frame(id, age, n = 500)(which works perfectly) in R 3.6.0 and wakefield 0.3.3... Perhaps this has to do with R enforcing the use of namespaces in packages at some point between this question and now.
A packages function always look for bindings in the package's namespace first, it seems.