Pfaff, Bernhard Dr.
2006-Nov-03 10:50 UTC
[Rd] WG: Formal methods are not loaded from NAMESPACE inreloadedworkspace image
Sorry, to bother the list one more time: but the following worked at least for 'urca': in NAMESPACE I now included explicitly: import(methods) a fix of the 'urca'-package will be uploaded to CRAN on the weekend. Fritz, will this work for ypur package 'flexclust' too? I have in my DESCRIPTION imports: methods and in flexclust it is in depends: methods. However, both packages have not import(methods) in their NAMESPACE. Anyway, I wonder why 'import(methods)' is explicitly needed in NAMESPACE? Would a smart and bright soul be so kind and enlighten a flabbergasted one? :-) Many thanks! Best, Bernhard>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 >> > >______________________________________________ >R-devel at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-devel >
Seth Falcon
2006-Nov-03 14:44 UTC
[Rd] WG: Formal methods are not loaded from NAMESPACE inreloadedworkspace image
"Pfaff, Bernhard Dr." <Bernhard_Pfaff at fra.invesco.com> writes:> Sorry, to bother the list one more time: but the following worked at > least for 'urca': > > in NAMESPACE I now included explicitly: > > import(methods) > > a fix of the 'urca'-package will be uploaded to CRAN on the weekend. > Fritz, will this work for ypur package 'flexclust' too? I have in my > DESCRIPTION imports: methods and in flexclust it is in depends: methods. > However, both packages have not import(methods) in their NAMESPACE. > Anyway, I wonder why 'import(methods)' is explicitly needed in > NAMESPACE? Would a smart and bright soul be so kind and enlighten a > flabbergasted one? :-) Many thanks!Because 4 > 1. I share your flabbergasted state. As I understand it, if you want to use methods, you might need to: 1. Say so in .onLoad where you require(methods) 2. Certainly Depends: methods 3. As you found, in the NAMESPACE file it helps to import(methods) 4. But then you also need to Import: methods + seth
John Chambers
2006-Nov-03 14:51 UTC
[Rd] WG: Formal methods are not loaded from NAMESPACE inreloadedworkspace image
Well, at the moment I'm a little confused too. It's not at all as simple as my previous mail suggested. Here's what I know, and unfortunately I won't have too much time to look further for a while. Starting from a clean folder (no saved workspace): > library(urca) > showMethods("summary") Function: summary (package base) object="ANY" object="ca.jo" object="ca.po" object="cajo.test" object="ur.df" object="ur.ers" object="ur.kpss" object="ur.pp" object="ur.sp" object="ur.za" so you do get the methods desired. But after example(ur.df), quit and save the workspace, then restart R: > library(urca) > showMethods("summary") Function "summary": <not a generic function> The effect does depend on something related to the example() calculation; just saving an arbitrary object in the workspace won't produce the bug. I'll look into the effect of having an explicit import(methods) when I get a chance, but it's not clear why that is connected to running the example. (Now the question is interesting enough that I won't give you a hard time about the practical motivation!) Pfaff, Bernhard Dr. wrote:> Sorry, to bother the list one more time: but the following worked at > least for 'urca': > > in NAMESPACE I now included explicitly: > > import(methods) > > a fix of the 'urca'-package will be uploaded to CRAN on the weekend. > Fritz, will this work for ypur package 'flexclust' too? I have in my > DESCRIPTION imports: methods and in flexclust it is in depends: methods. > However, both packages have not import(methods) in their NAMESPACE. > Anyway, I wonder why 'import(methods)' is explicitly needed in > NAMESPACE? Would a smart and bright soul be so kind and enlighten a > flabbergasted one? :-) Many thanks! > > Best, > Bernhard > > >> 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 >> >> > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >[[alternative HTML version deleted]]
Possibly Parallel Threads
- Formal methods are not loaded from NAMESPACE in reloadedworkspace image
- Formal methods are not loaded from NAMESPACE in reloaded workspace image
- Package update: 'urca' version 0.3-3
- urca package - summary method -
- question regarding kpss tests from urca, uroot and tseries packages