Re: [R] import function without overwriting function with the same name

2013-08-04 Thread Michael Friendly
On 03/08/2013 10:27 PM, Martin Batholdy wrote: I have to import multiple R-files. Each file consists of several functions with the same function name across the R-files. When I import all files one by one (with source()) I overwrite the function definition of the previous file until only the v

Re: [R] import function without overwriting function with the same name

2013-08-04 Thread Bert Gunter
Because that exposes the identically named functions and forces the user to sort them out, inviting mistakes, especially when trying to maintain/update them. My view is that one should try to program to make code as robust and maintainable as possible. Nevertheless, as I said, maybe this approach

Re: [R] import function without overwriting function with the same name

2013-08-03 Thread Siraaj Khandkar
On 08/03/2013 05:32 PM, Bert Gunter wrote: 4. Or, probably the least desirable approach that may nevertheless be what you may want, is just to attach your collections of functions and access them by fully qualified names. See ?"::" for details on how to do that. Why do you feel this is least

Re: [R] import function without overwriting function with the same name

2013-08-03 Thread William Dunlap
envir) envir$f(100), FUN.VAL=0) [1] 101 102 103 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Martin Batholdy > Sent: Saturday, August 03, 20

Re: [R] import function without overwriting function with the same name

2013-08-03 Thread Bert Gunter
Martrin: It sounds like you have some homework to do. Moreover, you have not provided sufficient information (for me, anyway) to give a definitive answer: why/how are the functions different? How are they used? 1) "Import" is not the same as "source." "Import" is something one does with packages

Re: [R] import function without overwriting function with the same name

2013-08-03 Thread Jeff Newmiller
This kind of thing gets dealt with as part of building packages. You can patch together your own namespace management (?attachNamespace) but you are better served to start developing your functions into packages once your projects get large enough that you start worrying about name collisions. -

Re: [R] import function without overwriting function with the same name

2013-08-03 Thread Martin Batholdy
> env.lst <- lapply(1:5, new.env) > > seems to work just fine ok, as far as I understand I would create 5 new environments by this. But how do I access and change the environment? What is the name of the environment? Here is a more concrete example and the general problem: source('functions1.R

Re: [R] import function without overwriting function with the same name

2013-08-03 Thread Ken Knoblauch
Martin Batholdy googlemail.com> writes: > I have to import multiple R-files. > Each file consists of several functions with the same function name across the R-files. > When I import all files one by one (with source()) I overwrite the function definition of the previous file > until only the ve

[R] import function without overwriting function with the same name

2013-08-03 Thread Martin Batholdy
Hi, I have to import multiple R-files. Each file consists of several functions with the same function name across the R-files. When I import all files one by one (with source()) I overwrite the function definition of the previous file until only the very last function definition lasts. However