Dear R-help list - 

Here's my problem.  I have some programs I want to share with other users in 
the department.  I currently tell users to use source("/path/to/myfile.R") to 
include the program.  If I understand correctly, this puts all the functions I 
wrote into the user's namespace.  So if I have a function my.func() and if the 
user already had a function named my.func(), I just replaced the user's 
function with my own.  

I know packages have a namespace mechanism.  Is there a way to put my functions 
into their own name space without using packages?   If yes, please let me know 
how.  If no, that's OK, maybe we will decide that all shared files have to be 
in packages.  One reason we're avoiding packages is we might have a number of 
unrelated R functions and the question becomes whether each file should get put 
in it's own package or they all get put into a "miscellaneous" package. 

As a follow-up question, a local expert suggested packages are the way to go 
(but also suggested getting a 2nd opinion on R-help).  If packages are the way 
to go, which is better: 
(a) we let users attach packages to the search path using library() and 
instruct them that they are responsible for avoiding any conflicts between 
names exported by the package and objects in their workspace?
(b) we tell users not to use library() so that if they call package functions 
there are fully qualified names and no potential for conflict, i.e  
PKG::myfunc()?

Thanks in advance -

Ray Griner
Statistical Programmer
Center for Biostatistics in AIDS Research Harvard School of Public Health, 
Boston, MA

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to