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

Michael Friendly friendly at yorku.ca
Sun Aug 4 22:05:25 CEST 2013


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 very last function definition lasts.
> However, I need them separately (although they have the name, they solve a certain task differently).

Others have taken your request literally, but since you haven't told 
anyone what your functions do or listed one, people can only guess.

Is it at all possible that your functions could be generalized to do the 
'certain task', by including other arguments allowing one function
to do that 'differently'?

Very often in R, as in other things, if you find that you need to do 
something so bizarre as reading many functions with the same name,
it's time to re-think a different approach that would end up not
requiring such machinations.

-Michael



More information about the R-help mailing list