trinker / wakefield

Generate random data sets
256 stars 28 forks source link

use package without calling library(wakefield) #11

Open jackwasey opened 7 years ago

jackwasey commented 7 years ago

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.

dannyparsons commented 5 years ago

+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.

iqis commented 5 years ago

@jackwasey This is a very generalizable problem. Nowadays many people prefer not to risk polluting their global search path.

trinker commented 5 years ago

@iqis any interest in a pull request?

iqis commented 5 years ago

@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.