On 13-08-03 3:47 AM, Rguy wrote:
I sometimes find that a function I have defined has the same name as an R
core function. In most cases I have no desire to redefine the core R
function and would prefer to give my function a different name.

The problem is that R lets users redefine its core functions without any
warning. Is there a way to cause R to generate a warning if a core function
is being redefined?

To give an actual example, in my personal library of functions I have a
'seek' function. I recently noticed that seek(con, ...) is part of base R.
Now I plan to rename my personal 'seek' function but would have benefited
from a warning when I first created this function.

You haven't redefined the core function, you have created a new function that masks it. The original is still available.

The solution is to keep your personal library of functions small so masking is obvious or not a problem, or to put it into a package. If you put your personal library into a package, you'll be warned if your package masks a base function.

Duncan Murdoch

______________________________________________
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