From: Martyn Plummer <plummer_at_iarc.fr>

Date: Thu 13 Jul 2006 - 03:06:35 EST

This message and its attachments are strictly confidential. ...{{dropped}}

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 13 03:14:04 2006

Date: Thu 13 Jul 2006 - 03:06:35 EST

My guess is that even though the zoo namespace is unloaded. The S3 method as.Date.numeric is still registered, and the name space will be reloaded whenever it is dispatched.

> library(zoo)

> loadedNamespaces()

[1] "base" "graphics" "grDevices" "methods" "stats" "utils"
[7] "zoo"

> unloadNamespace("zoo")

<environment: namespace:zoo>

> loadedNamespaces() #Gone

[1] "base" "graphics" "grDevices" "methods" "stats" "utils"

> as.Date(1)

[1] "1970-01-02"

> loadedNamespaces() #Back again!

[1] "base" "graphics" "grDevices" "methods" "stats" "utils"
[7] "zoo"

So the question is whether there is a way to unregister an S3 method, so that you can restore the method dispatching behaviour prior to the package being loaded. I don't know the answer, but I'm guessing it's no.

On Wed, 2006-07-12 at 09:21 -0400, Gabor Grothendieck wrote:

> Note that even this entered into a fresh session exhibits this

*> behavior. There is no use of ::: here:
**>
**> > as.Date(1)
**> Error in as.Date.default(1) : do not know how to convert '1' to class "Date"
**> > library(zoo)
**> > as.Date(1)
**> [1] "1970-01-02"
**> > unloadNamespace("zoo")
**> <environment: namespace:zoo>
**> > as.Date(1)
**> [1] "1970-01-02"
**> > R.version.string
**> [1] "Version 2.3.1 Patched (2006-06-04 r38279)"
**> > packageDescription("zoo")$Version
**> [1] "1.1-1"
**>
**> On 7/12/06, Roger Peng <rdpeng@gmail.com> wrote:
**> > I believe (3) should always work as long as zoo has a namespace. The
**> > ':::' operator will load the namespace of the package but will not
**> > attach it to the search list.
**> >
**> > -roger
**> >
**> > On 7/11/06, Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
**> > > We try the following:
**> > >
**> > > search()
**> > > as.Date(1)
**> > > zoo:::as.Date.numeric
**> > >
**> > > under three circumstances:
**> > >
**> > > 1. on a fresh session
**> > > 2. after issuing library(zoo) noting that as.Date.numeric is provided by zoo
**> > > 3. after detaching zoo
**> > >
**> > > as.Date(1) fails on #1 but succeeds in #2 and #3. Should it not fail in #3
**> > > since zoo was detached? Is this how its supposed to work?
**> > >
**> > > (Note that entering zoo:::as.Date.numeric at the console
**> > > succeeds in displaying the function in all three cases.)
**> > >
**> > > Here is the console session:
**> > >
**> > > > R.version.string # XP
**> > > [1] "Version 2.3.1 Patched (2006-06-04 r38279)"
**> > > >
**> > > > search()
**> > > [1] ".GlobalEnv" "package:methods" "package:stats"
**> > > [4] "package:graphics" "package:grDevices" "package:utils"
**> > > [7] "package:datasets" "Autoloads" "package:base"
**> > > > as.Date(1)
**> > > Error in as.Date.default(1) : do not know how to convert '1' to class "Date"
**> > > > zoo:::as.Date.numeric
**> > > function (x, ...)
**> > > structure(floor(x + 0.001), class = "Date")
**> > > <environment: namespace:zoo>
**> > > >
**> > > > library(zoo)
**> > > > search()
**> > > [1] ".GlobalEnv" "package:zoo" "package:methods"
**> > > [4] "package:stats" "package:graphics" "package:grDevices"
**> > > [7] "package:utils" "package:datasets" "Autoloads"
**> > > [10] "package:base"
**> > > > as.Date(1)
**> > > [1] "1970-01-02"
**> > > > zoo:::as.Date.numeric
**> > > function (x, ...)
**> > > structure(floor(x + 0.001), class = "Date")
**> > > <environment: namespace:zoo>
**> > > >
**> > > > detach()
**> > > > search()
**> > > [1] ".GlobalEnv" "package:methods" "package:stats"
**> > > [4] "package:graphics" "package:grDevices" "package:utils"
**> > > [7] "package:datasets" "Autoloads" "package:base"
**> > > > as.Date(1)
**> > > [1] "1970-01-02"
**> > > > zoo:::as.Date.numeric
**> > > function (x, ...)
**> > > structure(floor(x + 0.001), class = "Date")
**> > > <environment: namespace:zoo>
**> > > >
**> > >
**> > > ______________________________________________
**> > > R-help@stat.math.ethz.ch mailing list
**> > > https://stat.ethz.ch/mailman/listinfo/r-help
**> > > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
**> > >
**> >
**> >
**> > --
**> > Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/
**> >
**>
**> ______________________________________________
**> R-help@stat.math.ethz.ch mailing list
**> https://stat.ethz.ch/mailman/listinfo/r-help
**> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
*

This message and its attachments are strictly confidential. ...{{dropped}}

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 13 03:14:04 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Thu 13 Jul 2006 - 04:21:58 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*