Pfaff, Bernhard Dr.
2006-Nov-03 09:41 UTC
[Rd] Formal methods are not loaded from NAMESPACE in reloadedworkspace image
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>Dear R-Devel subscriber, > >I was hinted to the following problem with package 'urca': > >If one starts R and executes for instance: > >> library(urca) >> example(ur.df) >## output as expected, but omitted here >> class(lc.df) >[1] "ur.df" >attr(,"package") >[1] "urca" >> class(summary(lc.df)) >[1] "sumurca" >attr(,"package") >[1] "urca" >> > >everything works fine. Now, save the workspace image and quit R. After >starting R again with the previously restored workspace image one has: > >> ls() >[1] "lc.df" "Raotbl3" >> class(lc.df) >[1] "ur.df" >attr(,"package") >[1] "urca" > >lc.df >## now the 'show'-method for objects of class 'ur.df' is not utilised, >rather the generic >## displaying all slots > >> library(urca) >> lc.df > >## still the same as compared to the above output. >## similarily > >> class(summary(lc.df)) >[1] "table" > > >In the NAMESPACE file export directives for methods and classes are >included as: > >## Classes >exportClasses("urca", "ca.jo", "cajo.test", "ur.kpss", "ca.po", >"ur.ers", "ur.pp", "ur.sp", "ur.df", "ur.za", "sumurca") >## Methods >exportMethods("show", "plot", "summary") > >Any help or pointers for solving this problem is much appreciated. > >Best, >Bernhard > >> sessionInfo() >R version 2.5.0 Under development (unstable) (2006-10-10 r39600) >i386-pc-mingw32 > >locale: >LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_ >MONETARY>German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 > >attached base packages: >[1] "methods" "stats" "graphics" "grDevices" "datasets" "utils" > >[7] "base" > >other attached packages: > urca fortunes > "1.0-0" "1.3-2" >***************************************************************** >Confidentiality Note: The information contained in this >mess...{{dropped}} > >______________________________________________ >R-devel at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-devel >
John Chambers
2006-Nov-03 13:58 UTC
[Rd] Formal methods are not loaded from NAMESPACE in reloadedworkspace image
I haven't had a chance to verify these exact examples, but the likely explanation is that loading the workspace does not cache the saved methods. Assuming this is indeed what's happening, the workaround is to cache them "manually" by the call: cacheMetaData(.GlobalEnv) (after attaching the relevant library) It would be nice to have the same effect occur automatically, but there may be issues since the needed class definitions may not be available when the saved workspace is reloaded. A natural question to ask is whether there is some practical motivation for this exercise. Pfaff, Bernhard Dr. wrote:> 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 > > >> Dear R-Devel subscriber, >> >> I was hinted to the following problem with package 'urca': >> >> If one starts R and executes for instance: >> >> >>> library(urca) >>> example(ur.df) >>> >> ## output as expected, but omitted here >> >>> class(lc.df) >>> >> [1] "ur.df" >> attr(,"package") >> [1] "urca" >> >>> class(summary(lc.df)) >>> >> [1] "sumurca" >> attr(,"package") >> [1] "urca" >> >> everything works fine. Now, save the workspace image and quit R. After >> starting R again with the previously restored workspace image one has: >> >> >>> ls() >>> >> [1] "lc.df" "Raotbl3" >> >>> class(lc.df) >>> >> [1] "ur.df" >> attr(,"package") >> [1] "urca" >> >> lc.df >> ## now the 'show'-method for objects of class 'ur.df' is not utilised, >> rather the generic >> ## displaying all slots >> >> >>> library(urca) >>> lc.df >>> >> ## still the same as compared to the above output. >> ## similarily >> >> >>> class(summary(lc.df)) >>> >> [1] "table" >> >> >> In the NAMESPACE file export directives for methods and classes are >> included as: >> >> ## Classes >> exportClasses("urca", "ca.jo", "cajo.test", "ur.kpss", "ca.po", >> "ur.ers", "ur.pp", "ur.sp", "ur.df", "ur.za", "sumurca") >> ## Methods >> exportMethods("show", "plot", "summary") >> >> Any help or pointers for solving this problem is much appreciated. >> >> Best, >> Bernhard >> >> >>> sessionInfo() >>> >> R version 2.5.0 Under development (unstable) (2006-10-10 r39600) >> i386-pc-mingw32 >> >> locale: >> LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_ >> MONETARY>> German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 >> >> attached base packages: >> [1] "methods" "stats" "graphics" "grDevices" "datasets" "utils" >> >> [7] "base" >> >> other attached packages: >> urca fortunes >> "1.0-0" "1.3-2" >> ***************************************************************** >> Confidentiality Note: The information contained in this >> mess...{{dropped}} >> >> ______________________________________________ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> >> > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >[[alternative HTML version deleted]]
Possibly Parallel Threads
- WG: Formal methods are not loaded from NAMESPACE inreloadedworkspace image
- Formal methods are not loaded from NAMESPACE in reloaded workspace image
- all.names() and all.vars(): sorting order of functions' return vector
- Cointegration and ECM in Package {urca}
- Package update: 'urca' version 0.3-3