I'll update ITS to include that signature.

Right now, the only signature for Arith is:
signature(e1="its",e2="its").

Thx,
Whit


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Martin Maechler
> Sent: Tuesday, November 14, 2006 11:24 AM
> To: Stefan Albrecht
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] Error in str(its-object)
> 
> >>>>> "StAl" == Albrecht, Dr Stefan (AZ Private Equity 
> Partner) <[EMAIL PROTECTED]>
> >>>>>     on Tue, 14 Nov 2006 15:36:45 +0100 writes:
> 
>     StAl> Dear all, on my Windows XP R 2.4.0 version with
>     StAl> Package its version 1.1.4 I have a problem with str()
>     StAl> applied on an its-object after a simple matrix
>     StAl> manipulation on the its object (see below).  I am not
>     StAl> sure, whether this a problem with my application, its
>     StAl> or str().
>  
> I'd say mainly with its, and then with R internal arithmetic.
> str() actually reveals that the object you produce is not 
> ``valid'' anymore in a certain sense (see below).
> 
>     StAl> .......... But its object should be able to handle 
> simple matrix
>     StAl> multiplications, even if the result is a matrix.  Any
>     StAl> help is greatly appreciated.
>  
> "/ 1" is not a simple multiplication. 
> But I agree that package
> "its" (which you failed to mention) should make sure that
>       ' <itsObj> / 1 '
> 
> should work -- which it does not.  Here is a reproducible 
> example script - extended from your transcript :
> 
> --------------------------------------------------------------
> ------------
> 
> (mat <- matrix(1:6, 2,3,
>                
> dimnames=list(c("2003-01-01","2003-01-04"),letters[1:3])))
> library(its)
> (im <- its(mat))
> str(im)
> 
> isS4(im)    # TRUE, of course,  but ..
> isS4(im / 1)# FALSE !!!
> 
> ## even though
> class(im / 1)
> ## shows
> ## [1] "its"
> ## attr(,"package")
> ## [1] "its"
> 
> ## and the reason comes from
> selectMethod("/", signature(e1 = "its", e2 = "numeric")) ## 
> -> .Primitive("/")
> 
> --------------------------------------------------------------
> ------------
> 
> So what happens is that the builtin arithmetic *does* work on 
> the .Data slot automatically -- as it should IIRC the green 
> book on this topic.
> 
> What the builtin arithmetic *fails* to do, is keeping the 
> S4-object bit.
> --> I'll post a version of this to R-devel, since I think we
> should consider improving the current behavior here.
> 
> For the current version of R, the maintainer of "its" should 
> really define "Arith" methods for signature("its", "numeric") 
> and signature("numeric", "its").
> 
> Martin Maechler, ETH Zurich
> 
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
> 




This e-mail message is intended only for the named recipient(s) above. It may 
contain confidential information. If you are not the intended recipient you are 
hereby notified that any dissemination, distribution or copying of this e-mail 
and any attachment(s) is strictly prohibited. If you have received this e-mail 
in error, please immediately notify the sender by replying to this e-mail and 
delete the message and any attachment(s) from your system. Thank you.

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to