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
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
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
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
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
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.
-
> 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
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
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
9 matches
Mail list logo