Skip to content

Formal methods are not loaded from NAMESPACE in reloadedworkspace image

6 messages · Seth Falcon, Pfaff, Bernhard Dr., John Chambers

#
Dear R-Devel subscriber,

as a follow up to my yesterday's email: I tested an analogous example
with the S4-package "flexclust" by executing the following code:

library(flexclust)
example(cclust)
cl

After saving the work space and starting a new R process with the
restored work space, the same behaviour (i.e., the methods pertinent to
"flexclust" are not used, even after executing  library(flexclust)).
Yesterday, I executed the code below on a Linux platform with R 2.4.0
and it showed the same behaviour as R 2.5.0dev on Windows. As it seems
right now, the behaviour is platform independent and not peculiar to R
2.5.0dev.

Any pointers and help for solving this problem is much appreciated.

Best,
Bernhard
#
John Chambers <jmc at r-project.org> writes:
The main use case is that since serialization of objects is such an
R-ish thing to do, you really want to have deserialized S4 instances
"work" properly when loaded.

I admit that it is also useful to be able to load an arbitrary object
and inspect it even if it will be "broken" (without this, it would be
very hard to write any sort of automated class update code).  It would
seem that this behavior could be achieved in a force=TRUE mode and
that otherwise, it would be an error to deserialize an S4 instance
when the class def is not available.

+ seth
#
Dear John, Dear Seth,

many (a thousands) thanks for your clarification and highlighting of the
problem.
Hm, yes, that seems to be true. I do not know what the R-wizard Prof.
Douglas Bates has done, but going through the same exercise with:

library(lme4)
example(lmer)

saving the work space (without moving it to another file), quitting R
and starting such that the previously work space is restored, will yield
the following:
[1] "fm1" "fm2"
Function "summary":
 <not a generic function>
Loading required package: lme4
Loading required package: Matrix
Loading required package: lattice

## output as expected, but omitted here

Well, John, referring to your question. IMHO it is a question how useRs
work with R. Personnaly, I almost never work with work spaces but rather
scripts: write it - like it or fudge it. Anyway, a useR has pointed me
to this behaviour and I reckon that he uses the 'save work
space'-approach for an E-lab class that he teaches.   

Aside, of this issue and something more for R-Core, I am wondering if
some hint/pointer should be placed in the R-ext document (maybe in the
section 'Package name spaces' and/or in the subsection 'The DESCRIPTION
file'). I have re-read it, but could not find a hint with respect to
'methods' and 'S4'.

Let me thank you once more for your time taken, patience devoted and
enlightenment given to this problem. I must confess, that 'serialization
of R objects' is beyond the scope of my computer literacy as an
economist.

Gratefully,
Bernhard
*****************************************************************
Confidentiality Note: The information contained in this mess...{{dropped}}
1 day later