[Rd] An artifact of base being namespace

Saikat DebRoy saikat at stat.wisc.edu
Thu Oct 9 12:41:01 MEST 2003


Function in the base library of R 1.8.0 seems to use a search path with 
base coming before the local environment. I think this is intentional 
and is related to base being a namespace.

 > log <- function(x, base) 200
 > log(1)
[1] 200
 > log10
function (x)
log(x, 10)
<environment: namespace:base>
 > log10(1)
[1] 0
 >

This is most problematic when you are creating a generic for an 
existing function in base (as you very well could for log). This often 
makes the ability to make new generics out of existing functions 
somewhat useless.



More information about the R-devel mailing list