Dear R-users,

I have some questions about the scope of functions, which I would like to
illustrate with the following example:

### First example
require(Hmisc)

combine.levels <- function(x,y) browser()
whatever <- function(x,y) combine.levels(x,y)

x <- 1:5
names(x) <- LETTERS[x]
y <- 6: 10
names(y) <- LETTERS[y-2]

combine(x,y)  # no debugging break
whatever(x,y)  # debugging break


The Hmisc package contains the two original functions 'combine' and
'combine.levels': 'combine' calls 'combine.levels' to perform some
operations. Now, by defining my own (useless) 'combine.levels' function, I
thought I would mask Frank Harrell's function for all functions calling
'combine.levels' in my downstream code. This is obviously not the case, as
illustrated by the two last calls of the script above. Therefore, my
questions are:
- how can I completely mask the Hmisc 'combine.levels' function in my
example above, while still making the remaining function of Hmisc available?
- if I pack the function 'whatever' and my version of 'combine.levels' in a
new package and modify my example as follows, will I get the same problem of
scope?

### Second example
require(Hmisc)
require(myUselessPackage) # contains custom functions: whatever and
combine.levels

x <- 1:5
names(x) <- LETTERS[x]
y <- 6: 10
names(y) <- LETTERS[y-2]

combine(x,y)
whatever(x,y)

Thanks in advance of your help.

Sebastien

	[[alternative HTML version deleted]]

