Hello all,
I'm sure I'm missing something simple here, but I can't figure out how to
modify the glm.fit() function and then get R to use it (sort of). I'm doing
something along the lines of:

glm.fit<-edit(glm.fit) # add something trivial to the top of the glm.fit
function like: print("Hello world!")

#now have a modified glm.fit in position 1/.GlobalEnv

x<-rnorm(20)
y<-rnomr(20)

glm(y~x)  # I don't get the trivial bit of glm.fit back (i.e. "Hello world!"
doesn't print)

#but

glm(y~x,method=glm.fit) # works! I get "Hello world!"

My understanding is that glm() should call glm.fit() by default but it seems
to be calling the glm.fit() in "package:stats" and not ".GlobalEnv". Why
isn't the function in ".GlobalEnv" superseding the version in
"package:stats"?

Thanks,
Ben


version:

platform       i386-pc-mingw32
arch           i386
os             mingw32
system         i386, mingw32
status
major          2
minor          11.1
year           2010
month          05
day            31
svn rev        52157
language       R
version.string R version 2.11.1 (2010-05-31)

        [[alternative HTML version deleted]]

______________________________________________
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