[R] Method dispatch sometimes failsfor lavaan objects

2019-12-05 Thread Ulrich KELLER
Hello, in some R sessions, method dispatch for objects of the (S4) class “lavaan" fail. An example from such a “bad” session: > library(lavaan) > HS.model <- ' visual =~ x1 + x2 + x3 + textual =~ x4 + x5 + x6 + speed =~ x7 + x8 + x9 ' > fit <- cfa(HS.model, data =

Re: [R] Method dispatch in S4

2013-08-09 Thread Bert Gunter
Please read the proto vignette before asking further questions about it. It is an alternative to/version of OOP different from S3 and S4. -- Bert On Fri, Aug 9, 2013 at 8:13 AM, Simon Zehnder wrote: > Hi Martin, > > is proto in S3? > > I will take a look first at the simple package EBImage. > >

Re: [R] Method dispatch in S4

2013-08-09 Thread Simon Zehnder
Hi Martin, is proto in S3? I will take a look first at the simple package EBImage. Thank you very much for the suggestions! Best Simon On Aug 9, 2013, at 5:01 PM, Martin Morgan wrote: > On 08/09/2013 07:45 AM, Bert Gunter wrote: >> Simon: >> >> Have a look at the "proto" package for whi

Re: [R] Method dispatch in S4

2013-08-09 Thread Martin Morgan
On 08/09/2013 07:45 AM, Bert Gunter wrote: Simon: Have a look at the "proto" package for which there is a vignette. You may find it suitable for your needs and less intimidating. Won't help much with S4, though! Some answers here http://stackoverflow.com/questions/5437238/which-packages-make-

Re: [R] Method dispatch in S4

2013-08-09 Thread Simon Zehnder
Hi Bert, thank you very much for your suggestion! I will take a look at it soon! Best Simon On Aug 9, 2013, at 4:45 PM, Bert Gunter wrote: > Simon: > > Have a look at the "proto" package for which there is a vignette. You > may find it suitable for your needs and less intimidating. > > Chee

Re: [R] Method dispatch in S4

2013-08-09 Thread Bert Gunter
Simon: Have a look at the "proto" package for which there is a vignette. You may find it suitable for your needs and less intimidating. Cheers, Bert On Fri, Aug 9, 2013 at 7:40 AM, Simon Zehnder wrote: > Hi Martin, > > thank you very much for this profound answer! Your added design advice is >

Re: [R] Method dispatch in S4

2013-08-09 Thread Simon Zehnder
Hi Martin, thank you very much for this profound answer! Your added design advice is very helpful, too! For the 'simple example': Sometimes I am still a little overwhelmed from a certain setting in the code and my ideas how I want to handle a process. But I learn from session to session. In f

Re: [R] Method dispatch in S4

2013-08-08 Thread Martin Morgan
On 08/04/2013 02:13 AM, Simon Zehnder wrote: So, I found a solution: First in the "initialize" method of class C coerce the C object into a B object. Then call the next method in the list with the B class object. Now, in the "initialize" method of class B the object is a B object and the respecti

Re: [R] Method dispatch in S4

2013-08-04 Thread Simon Zehnder
So, I found a solution: First in the "initialize" method of class C coerce the C object into a B object. Then call the next method in the list with the B class object. Now, in the "initialize" method of class B the object is a B object and the respective "generateSpec" method is called. Then, in

[R] Method dispatch in S4

2013-08-03 Thread Simon Zehnder
Dear R-Users and R-Devels, I am struggling with the method dispatch for S4 objects. First I will give a simple example to make clear what the general setting in my project is. Three classes will be build in the example: A is just a simple class. B contains A in a slot and C inherits from B. In

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Taras Zakharko
Thank you both for very helpful answers. I have indeed missed the help pages about "(" and now the situation is more clear. > You can use this syntax by defining a function `x<-` <- function(...) {} > and it could be an S3 method, but it is a completely separate object from > x. Unfortunately

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Prof Brian Ripley
The details here are much more appropriate for R-devel, but please check the help pages for "(" and "[", and note - "[" is generic and "(" is not. - the primitive `(` is used to implement constructions such as (x <- pi) and not x(...). The special handling of operators such as "[" is part of th

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Duncan Murdoch
On 11-01-13 3:09 AM, Taras Zakharko wrote: Dear R gurus, I am trying to create a nicer API interface for some R modules I have written. Here, I heavily rely on S3 method dispatch mechanics and makeActiveBinding() function I have discovered that I apparently can't dispatch on function call

[R] Method dispatch for function call operator?

2011-01-13 Thread Taras Zakharko
Dear R gurus, I am trying to create a nicer API interface for some R modules I have written. Here, I heavily rely on S3 method dispatch mechanics and makeActiveBinding() function I have discovered that I apparently can't dispatch on function call operator (). While .Primitive("(") exists, whi

Re: [R] Method dispatch

2010-03-01 Thread Martin Morgan
method in "exportMethods". What did I miss here? Thanks a lot > for your help. > > > > export(MackChainLadder, MunichChainLadder, BootChainLadder, MultiChainLadder) > export(Join2Fits, JoinFitMse, Mse, residCov) > > importFrom(stats, quantile, predict, coef, vcov,

Re: [R] Method dispatch

2010-03-01 Thread Zhang,Yanwei
tFrom(stats, quantile, predict, coef, vcov, residuals, fitted, fitted.values, rstandard) importFrom(methods, show, coerce) importFrom(graphics, plot) #Classes exportClasses(triangles, MultiChainLadder, MultiChainLadderFit, MCLFit, GMCLFit, MultiChainLadderMse)

Re: [R] Method dispatch

2010-03-01 Thread Martin Morgan
On 03/01/2010 01:31 PM, Zhang,Yanwei wrote: > Dear all, > > In a package, I defined a method for "summary" using setMethod(summary, signature="abc") for my class "abc", but when the package is loaded, the function "summary(x)" where x is of class "abc" seems to have called the default summary func

[R] Method dispatch

2010-03-01 Thread Zhang,Yanwei
Dear all, In a package, I defined a method for "summary" using setMethod(summary, signature="abc") for my class "abc", but when the package is loaded, the function "summary(x)" where x is of class "abc" seems to have called the default summary function for "ANY" class. Shouldn't it call the met

[R] Method dispatch for function

2009-11-18 Thread Stavros Macrakis
How can I determine what S3 method will be called for a particular first-argument class? I was imagining something like functionDispatch('str','numeric') => utils:::str.default , but I can't find anything like this. For that matter, I was wondering if anyone had written a version of `methods` whi