R 2.8.0 qqnorm produces error with object of class zoo?

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

R 2.8.0 qqnorm produces error with object of class zoo?

Pfaff, Bernhard Dr.
Dear list-reader,

by running the following script:

library(zoo)
sessionInfo()
search()
packageDescription("zoo")
data(EuStockMarkets)
dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
daxr <- diff(log(dax))
identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
qqnorm(coredata(daxr))
qqnorm(daxr)


qqnorm() produces an error:

> qqnorm(daxr)
Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
  Argument hat Länge 0
Calls: qqnorm ... xtfrm.default -> as.vector -> rank -> switch -> .gt
Ausführung angehalten


However, this is not witnessed by running the script through R 2.7.2 (attached are the two output files). Incidentally, the QQ-plot is produced if one uses "qqnorm(coredata(daxr))" under R version 2.8.0. After having read both NEWS on CRAN (General and Windows specific) I still could not figure out what causes this result. The version of package zoo is the same and the results do not change if I use the zoo package built under R version 2.7.2 with R version 2.7.2 or the one that has been built under R version 2.8.0.

Any hints and enlightenment are most welcome.

Best,
Bernhard


*****************************************************************
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*****************************************************************

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Pfaff, Bernhard Dr.
It seems, that in my previous emails the attached output files got deleted, hence these are now copied below:

For R version 2.7.2:
====================
R version 2.7.2 (2008-08-25)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R ist freie Software und kommt OHNE JEGLICHE GARANTIE.
Sie sind eingeladen, es unter bestimmten Bedingungen weiter zu verbreiten.
Tippen Sie 'license()' or 'licence()' für Details dazu.

R ist ein Gemeinschaftsprojekt mit vielen Beitragenden.
Tippen Sie 'contributors()' für mehr Information und 'citation()',
um zu erfahren, wie R oder R packages in Publikationen zitiert werden können.

Tippen Sie 'demo()' für einige Demos, 'help()' für on-line Hilfe, oder
'help.start()' für eine HTML Browserschnittstelle zur Hilfe.
Tippen Sie 'q()', um R zu verlassen.


Invesco colors have been created!
Usage: "col = invcolor[1]", or "col = invcolor['blue']" etc.
Type: 'invcolor' to see its definition.

[Vorher gesicherter Workspace wiederhergestellt]

> library(zoo)

Attache Paket: 'zoo'


        The following object(s) are masked from package:base :

         as.Date.numeric

Warning message:
Paket 'zoo' wurde unter R Version 2.8.0 gebaut
> sessionInfo()
R version 2.7.2 (2008-08-25)
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] stats     graphics  utils     datasets  grDevices methods   base    

other attached packages:
[1] zoo_1.5-4

loaded via a namespace (and not attached):
[1] grid_2.7.2      lattice_0.17-13
> search()
 [1] ".GlobalEnv"        "package:zoo"       "package:stats"    
 [4] "package:graphics"  "package:utils"     "package:datasets"
 [7] "package:grDevices" "package:methods"   "Autoloads"        
[10] "package:base"    
> packageDescription("zoo")
Package: zoo
Version: 1.5-4
Date: 2008-07-09
Title: Z's ordered observations
Author: Achim Zeileis, Gabor Grothendieck
Maintainer: Achim Zeileis <[hidden email]>
Description: An S3 class with methods for totally ordered indexed
        observations. It is particularly aimed at irregular time series
        of numeric vectors/matrices and factors. zoo's key design goals
        are independence of a particular index/date/time class and
        consistency with with ts and base R by providing methods to
        extend standard generics.
Depends: R (>= 2.4.1), stats
Suggests: chron, fCalendar, fSeries, its, tseries, lattice,
        strucchange, DAAG, xts
Imports: stats, utils, graphics, grDevices, lattice
LazyLoad: yes
License: GPL-2
URL: http://R-Forge.R-project.org/projects/zoo/
Packaged: Wed Jul 9 18:28:07 2008; zeileis
Built: R 2.8.0; ; 2008-10-16 00:01:11; windows

-- File: C:/R/package/zoo/Meta/package.rds
> data(EuStockMarkets)
> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
> daxr <- diff(log(dax))
> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
[1] TRUE
Warning messages:
1: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
2: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
> qqnorm(coredata(daxr))
> qqnorm(daxr)
>
> proc.time()
       User      System verstrichen
       1.65        0.13        2.97

For R version 2.8.0:
====================
 version 2.8.0 (2008-10-20)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R ist freie Software und kommt OHNE JEGLICHE GARANTIE.
Sie sind eingeladen, es unter bestimmten Bedingungen weiter zu verbreiten.
Tippen Sie 'license()' or 'licence()' für Details dazu.

R ist ein Gemeinschaftsprojekt mit vielen Beitragenden.
Tippen Sie 'contributors()' für mehr Information und 'citation()',
um zu erfahren, wie R oder R packages in Publikationen zitiert werden können.

Tippen Sie 'demo()' für einige Demos, 'help()' für on-line Hilfe, oder
'help.start()' für eine HTML Browserschnittstelle zur Hilfe.
Tippen Sie 'q()', um R zu verlassen.


Invesco colors have been created!
Usage: "col = invcolor[1]", or "col = invcolor['blue']" etc.
Type: 'invcolor' to see its definition.

[Vorher gesicherter Workspace wiederhergestellt]

> library(zoo)

Attache Paket: 'zoo'


        The following object(s) are masked from package:base :

         as.Date.numeric

> sessionInfo()
R version 2.8.0 (2008-10-20)
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] stats     graphics  utils     datasets  grDevices methods   base    

other attached packages:
[1] zoo_1.5-4

loaded via a namespace (and not attached):
[1] grid_2.8.0      lattice_0.17-15
> search()
 [1] ".GlobalEnv"        "package:zoo"       "package:stats"    
 [4] "package:graphics"  "package:utils"     "package:datasets"
 [7] "package:grDevices" "package:methods"   "Autoloads"        
[10] "package:base"    
> packageDescription("zoo")
Package: zoo
Version: 1.5-4
Date: 2008-07-09
Title: Z's ordered observations
Author: Achim Zeileis, Gabor Grothendieck
Maintainer: Achim Zeileis <[hidden email]>
Description: An S3 class with methods for totally ordered indexed
        observations. It is particularly aimed at irregular time series
        of numeric vectors/matrices and factors. zoo's key design goals
        are independence of a particular index/date/time class and
        consistency with with ts and base R by providing methods to
        extend standard generics.
Depends: R (>= 2.4.1), stats
Suggests: chron, fCalendar, fSeries, its, tseries, lattice,
        strucchange, DAAG, xts
Imports: stats, utils, graphics, grDevices, lattice
LazyLoad: yes
License: GPL-2
URL: http://R-Forge.R-project.org/projects/zoo/
Packaged: Wed Jul 9 18:28:07 2008; zeileis
Built: R 2.8.0; ; 2008-10-16 00:01:11; windows

-- File: C:/R/package/zoo/Meta/package.rds
> data(EuStockMarkets)
> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
> daxr <- diff(log(dax))
> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
[1] TRUE
Warning messages:
1: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
2: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
> qqnorm(coredata(daxr))
> qqnorm(daxr)
Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
  Argument hat Länge 0
Calls: qqnorm ... xtfrm.default -> as.vector -> rank -> switch -> .gt
Ausführung angehalten


>
>Dear list-reader,
>
>by running the following script:
>
>library(zoo)
>sessionInfo()
>search()
>packageDescription("zoo")
>data(EuStockMarkets)
>dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>daxr <- diff(log(dax))
>identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>qqnorm(coredata(daxr))
>qqnorm(daxr)
>
>
>qqnorm() produces an error:
>
>> qqnorm(daxr)
>Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>  Argument hat Länge 0
>Calls: qqnorm ... xtfrm.default -> as.vector -> rank -> switch -> .gt
>Ausführung angehalten
>
>
>However, this is not witnessed by running the script through R
>2.7.2 (attached are the two output files). Incidentally, the
>QQ-plot is produced if one uses "qqnorm(coredata(daxr))" under
>R version 2.8.0. After having read both NEWS on CRAN (General
>and Windows specific) I still could not figure out what causes
>this result. The version of package zoo is the same and the
>results do not change if I use the zoo package built under R
>version 2.7.2 with R version 2.7.2 or the one that has been
>built under R version 2.8.0.
>
>Any hints and enlightenment are most welcome.
>
>Best,
>Bernhard
>
>
>*****************************************************************
>Confidentiality Note: The information contained in this message,
>and any attachments, may contain confidential and/or privileged
>material. It is intended solely for the person(s) or entity to
>which it is addressed. Any review, retransmission, dissemination,
>or taking of any action in reliance upon this information by
>persons or entities other than the intended recipient(s) is
>prohibited. If you received this in error, please contact the
>sender and delete the material from any computer.
>*****************************************************************
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Peter Dalgaard
Pfaff, Bernhard Dr. wrote:
> It seems, that in my previous emails the attached output files got deleted, hence these are now copied below:
>
>  
(If the MIME type is wrong, then that will happen.)

Anyways, the root cause seems to be the new function .gt() which is
related to

    o   New generic function xtfrm() as an auxiliary helper for
        sort(), order() and rank().  This should return a numeric
        vector that sorts in the same way as its input.  The default
        method supports any class with ==, > and is.na() methods but
        specific methods can be much faster.

        As a side-effect, rank() will now work better on classed
        objects, although possibly rather slowly.

Here, "better" may be in the eyes of the beholder, for

> dax[3]==dax[6]
Data:
logical(0)

Index:
integer(0)

and accordingly

> rank(dax)
Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
  argument is of length zero

which is the error that you are seeing.

What to do about it is a bit dubious. Obviously, we don't want to "fix"
.gt() so that it automatically unclasses objects, and I assume that zoo
has its reasons for not wanting to compare series with different
indices. So I suppose that either the user must unclass, or zoo define
rank.zoo.

> For R version 2.7.2:
> ====================
> R version 2.7.2 (2008-08-25)
> Copyright (C) 2008 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
>
> R ist freie Software und kommt OHNE JEGLICHE GARANTIE.
> Sie sind eingeladen, es unter bestimmten Bedingungen weiter zu verbreiten.
> Tippen Sie 'license()' or 'licence()' für Details dazu.
>
> R ist ein Gemeinschaftsprojekt mit vielen Beitragenden.
> Tippen Sie 'contributors()' für mehr Information und 'citation()',
> um zu erfahren, wie R oder R packages in Publikationen zitiert werden können.
>
> Tippen Sie 'demo()' für einige Demos, 'help()' für on-line Hilfe, oder
> 'help.start()' für eine HTML Browserschnittstelle zur Hilfe.
> Tippen Sie 'q()', um R zu verlassen.
>
>
> Invesco colors have been created!
> Usage: "col = invcolor[1]", or "col = invcolor['blue']" etc.
> Type: 'invcolor' to see its definition.
>
> [Vorher gesicherter Workspace wiederhergestellt]
>
>  
>> library(zoo)
>>    
>
> Attache Paket: 'zoo'
>
>
> The following object(s) are masked from package:base :
>
> as.Date.numeric
>
> Warning message:
> Paket 'zoo' wurde unter R Version 2.8.0 gebaut
>  
>> sessionInfo()
>>    
> R version 2.7.2 (2008-08-25)
> 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] stats     graphics  utils     datasets  grDevices methods   base    
>
> other attached packages:
> [1] zoo_1.5-4
>
> loaded via a namespace (and not attached):
> [1] grid_2.7.2      lattice_0.17-13
>  
>> search()
>>    
>  [1] ".GlobalEnv"        "package:zoo"       "package:stats"    
>  [4] "package:graphics"  "package:utils"     "package:datasets"
>  [7] "package:grDevices" "package:methods"   "Autoloads"        
> [10] "package:base"    
>  
>> packageDescription("zoo")
>>    
> Package: zoo
> Version: 1.5-4
> Date: 2008-07-09
> Title: Z's ordered observations
> Author: Achim Zeileis, Gabor Grothendieck
> Maintainer: Achim Zeileis <[hidden email]>
> Description: An S3 class with methods for totally ordered indexed
>         observations. It is particularly aimed at irregular time series
>         of numeric vectors/matrices and factors. zoo's key design goals
>         are independence of a particular index/date/time class and
>         consistency with with ts and base R by providing methods to
>         extend standard generics.
> Depends: R (>= 2.4.1), stats
> Suggests: chron, fCalendar, fSeries, its, tseries, lattice,
>         strucchange, DAAG, xts
> Imports: stats, utils, graphics, grDevices, lattice
> LazyLoad: yes
> License: GPL-2
> URL: http://R-Forge.R-project.org/projects/zoo/
> Packaged: Wed Jul 9 18:28:07 2008; zeileis
> Built: R 2.8.0; ; 2008-10-16 00:01:11; windows
>
> -- File: C:/R/package/zoo/Meta/package.rds
>  
>> data(EuStockMarkets)
>> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>> daxr <- diff(log(dax))
>> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>>    
> [1] TRUE
> Warning messages:
> 1: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
> 2: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>  
>> qqnorm(coredata(daxr))
>> qqnorm(daxr)
>>
>> proc.time()
>>    
>        User      System verstrichen
>        1.65        0.13        2.97
>
> For R version 2.8.0:
> ====================
>  version 2.8.0 (2008-10-20)
> Copyright (C) 2008 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
>
> R ist freie Software und kommt OHNE JEGLICHE GARANTIE.
> Sie sind eingeladen, es unter bestimmten Bedingungen weiter zu verbreiten.
> Tippen Sie 'license()' or 'licence()' für Details dazu.
>
> R ist ein Gemeinschaftsprojekt mit vielen Beitragenden.
> Tippen Sie 'contributors()' für mehr Information und 'citation()',
> um zu erfahren, wie R oder R packages in Publikationen zitiert werden können.
>
> Tippen Sie 'demo()' für einige Demos, 'help()' für on-line Hilfe, oder
> 'help.start()' für eine HTML Browserschnittstelle zur Hilfe.
> Tippen Sie 'q()', um R zu verlassen.
>
>
> Invesco colors have been created!
> Usage: "col = invcolor[1]", or "col = invcolor['blue']" etc.
> Type: 'invcolor' to see its definition.
>
> [Vorher gesicherter Workspace wiederhergestellt]
>
>  
>> library(zoo)
>>    
>
> Attache Paket: 'zoo'
>
>
> The following object(s) are masked from package:base :
>
> as.Date.numeric
>
>  
>> sessionInfo()
>>    
> R version 2.8.0 (2008-10-20)
> 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] stats     graphics  utils     datasets  grDevices methods   base    
>
> other attached packages:
> [1] zoo_1.5-4
>
> loaded via a namespace (and not attached):
> [1] grid_2.8.0      lattice_0.17-15
>  
>> search()
>>    
>  [1] ".GlobalEnv"        "package:zoo"       "package:stats"    
>  [4] "package:graphics"  "package:utils"     "package:datasets"
>  [7] "package:grDevices" "package:methods"   "Autoloads"        
> [10] "package:base"    
>  
>> packageDescription("zoo")
>>    
> Package: zoo
> Version: 1.5-4
> Date: 2008-07-09
> Title: Z's ordered observations
> Author: Achim Zeileis, Gabor Grothendieck
> Maintainer: Achim Zeileis <[hidden email]>
> Description: An S3 class with methods for totally ordered indexed
>         observations. It is particularly aimed at irregular time series
>         of numeric vectors/matrices and factors. zoo's key design goals
>         are independence of a particular index/date/time class and
>         consistency with with ts and base R by providing methods to
>         extend standard generics.
> Depends: R (>= 2.4.1), stats
> Suggests: chron, fCalendar, fSeries, its, tseries, lattice,
>         strucchange, DAAG, xts
> Imports: stats, utils, graphics, grDevices, lattice
> LazyLoad: yes
> License: GPL-2
> URL: http://R-Forge.R-project.org/projects/zoo/
> Packaged: Wed Jul 9 18:28:07 2008; zeileis
> Built: R 2.8.0; ; 2008-10-16 00:01:11; windows
>
> -- File: C:/R/package/zoo/Meta/package.rds
>  
>> data(EuStockMarkets)
>> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>> daxr <- diff(log(dax))
>> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>>    
> [1] TRUE
> Warning messages:
> 1: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
> 2: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>  
>> qqnorm(coredata(daxr))
>> qqnorm(daxr)
>>    
> Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>   Argument hat Länge 0
> Calls: qqnorm ... xtfrm.default -> as.vector -> rank -> switch -> .gt
> Ausführung angehalten
>
>
>  
>> Dear list-reader,
>>
>> by running the following script:
>>
>> library(zoo)
>> sessionInfo()
>> search()
>> packageDescription("zoo")
>> data(EuStockMarkets)
>> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>> daxr <- diff(log(dax))
>> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>> qqnorm(coredata(daxr))
>> qqnorm(daxr)
>>
>>
>> qqnorm() produces an error:
>>
>>    
>>> qqnorm(daxr)
>>>      
>> Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>  Argument hat Länge 0
>> Calls: qqnorm ... xtfrm.default -> as.vector -> rank -> switch -> .gt
>> Ausführung angehalten
>>
>>
>> However, this is not witnessed by running the script through R
>> 2.7.2 (attached are the two output files). Incidentally, the
>> QQ-plot is produced if one uses "qqnorm(coredata(daxr))" under
>> R version 2.8.0. After having read both NEWS on CRAN (General
>> and Windows specific) I still could not figure out what causes
>> this result. The version of package zoo is the same and the
>> results do not change if I use the zoo package built under R
>> version 2.7.2 with R version 2.7.2 or the one that has been
>> built under R version 2.8.0.
>>
>> Any hints and enlightenment are most welcome.
>>
>> Best,
>> Bernhard
>>
>>
>> *****************************************************************
>> Confidentiality Note: The information contained in this message,
>> and any attachments, may contain confidential and/or privileged
>> material. It is intended solely for the person(s) or entity to
>> which it is addressed. Any review, retransmission, dissemination,
>> or taking of any action in reliance upon this information by
>> persons or entities other than the intended recipient(s) is
>> prohibited. If you received this in error, please contact the
>> sender and delete the material from any computer.
>> *****************************************************************
>>
>>    
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>  


--
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])              FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Pfaff, Bernhard Dr.
Dear Peter,

many thanks for your swift reply and the enlightenment; much appreciated.  
I have cc'ed Achim as the package maintainer of zoo, in case this thread should have slipt his notice. Just curious, Achim, will there be a rank.zoo() function in a future release of your package?

Best,
Bernhard


>
>Pfaff, Bernhard Dr. wrote:
>> It seems, that in my previous emails the attached output
>files got deleted, hence these are now copied below:
>>
>>  
>(If the MIME type is wrong, then that will happen.)
>
>Anyways, the root cause seems to be the new function .gt() which is
>related to
>
>    o   New generic function xtfrm() as an auxiliary helper for
>        sort(), order() and rank().  This should return a numeric
>        vector that sorts in the same way as its input.  The default
>        method supports any class with ==, > and is.na() methods but
>        specific methods can be much faster.
>
>        As a side-effect, rank() will now work better on classed
>        objects, although possibly rather slowly.
>
>Here, "better" may be in the eyes of the beholder, for
>
>> dax[3]==dax[6]
>Data:
>logical(0)
>
>Index:
>integer(0)
>
>and accordingly
>
>> rank(dax)
>Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>  argument is of length zero
>
>which is the error that you are seeing.
>
>What to do about it is a bit dubious. Obviously, we don't want to "fix"
>.gt() so that it automatically unclasses objects, and I assume that zoo
>has its reasons for not wanting to compare series with different
>indices. So I suppose that either the user must unclass, or zoo define
>rank.zoo.
>
>> For R version 2.7.2:
>> ====================
>> R version 2.7.2 (2008-08-25)
>> Copyright (C) 2008 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>>
>> R ist freie Software und kommt OHNE JEGLICHE GARANTIE.
>> Sie sind eingeladen, es unter bestimmten Bedingungen weiter
>zu verbreiten.
>> Tippen Sie 'license()' or 'licence()' für Details dazu.
>>
>> R ist ein Gemeinschaftsprojekt mit vielen Beitragenden.
>> Tippen Sie 'contributors()' für mehr Information und 'citation()',
>> um zu erfahren, wie R oder R packages in Publikationen
>zitiert werden können.
>>
>> Tippen Sie 'demo()' für einige Demos, 'help()' für on-line
>Hilfe, oder
>> 'help.start()' für eine HTML Browserschnittstelle zur Hilfe.
>> Tippen Sie 'q()', um R zu verlassen.
>>
>>
>> Invesco colors have been created!
>> Usage: "col = invcolor[1]", or "col = invcolor['blue']" etc.
>> Type: 'invcolor' to see its definition.
>>
>> [Vorher gesicherter Workspace wiederhergestellt]
>>
>>  
>>> library(zoo)
>>>    
>>
>> Attache Paket: 'zoo'
>>
>>
>> The following object(s) are masked from package:base :
>>
>> as.Date.numeric
>>
>> Warning message:
>> Paket 'zoo' wurde unter R Version 2.8.0 gebaut
>>  
>>> sessionInfo()
>>>    
>> R version 2.7.2 (2008-08-25)
>> 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] stats     graphics  utils     datasets  grDevices
>methods   base    
>>
>> other attached packages:
>> [1] zoo_1.5-4
>>
>> loaded via a namespace (and not attached):
>> [1] grid_2.7.2      lattice_0.17-13
>>  
>>> search()
>>>    
>>  [1] ".GlobalEnv"        "package:zoo"       "package:stats"    
>>  [4] "package:graphics"  "package:utils"     "package:datasets"
>>  [7] "package:grDevices" "package:methods"   "Autoloads"        
>> [10] "package:base"    
>>  
>>> packageDescription("zoo")
>>>    
>> Package: zoo
>> Version: 1.5-4
>> Date: 2008-07-09
>> Title: Z's ordered observations
>> Author: Achim Zeileis, Gabor Grothendieck
>> Maintainer: Achim Zeileis <[hidden email]>
>> Description: An S3 class with methods for totally ordered indexed
>>         observations. It is particularly aimed at irregular
>time series
>>         of numeric vectors/matrices and factors. zoo's key
>design goals
>>         are independence of a particular index/date/time class and
>>         consistency with with ts and base R by providing methods to
>>         extend standard generics.
>> Depends: R (>= 2.4.1), stats
>> Suggests: chron, fCalendar, fSeries, its, tseries, lattice,
>>         strucchange, DAAG, xts
>> Imports: stats, utils, graphics, grDevices, lattice
>> LazyLoad: yes
>> License: GPL-2
>> URL: http://R-Forge.R-project.org/projects/zoo/
>> Packaged: Wed Jul 9 18:28:07 2008; zeileis
>> Built: R 2.8.0; ; 2008-10-16 00:01:11; windows
>>
>> -- File: C:/R/package/zoo/Meta/package.rds
>>  
>>> data(EuStockMarkets)
>>> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>>> daxr <- diff(log(dax))
>>> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>>>    
>> [1] TRUE
>> Warning messages:
>> 1: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>> 2: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>>  
>>> qqnorm(coredata(daxr))
>>> qqnorm(daxr)
>>>
>>> proc.time()
>>>    
>>        User      System verstrichen
>>        1.65        0.13        2.97
>>
>> For R version 2.8.0:
>> ====================
>>  version 2.8.0 (2008-10-20)
>> Copyright (C) 2008 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>>
>> R ist freie Software und kommt OHNE JEGLICHE GARANTIE.
>> Sie sind eingeladen, es unter bestimmten Bedingungen weiter
>zu verbreiten.
>> Tippen Sie 'license()' or 'licence()' für Details dazu.
>>
>> R ist ein Gemeinschaftsprojekt mit vielen Beitragenden.
>> Tippen Sie 'contributors()' für mehr Information und 'citation()',
>> um zu erfahren, wie R oder R packages in Publikationen
>zitiert werden können.
>>
>> Tippen Sie 'demo()' für einige Demos, 'help()' für on-line
>Hilfe, oder
>> 'help.start()' für eine HTML Browserschnittstelle zur Hilfe.
>> Tippen Sie 'q()', um R zu verlassen.
>>
>>
>> Invesco colors have been created!
>> Usage: "col = invcolor[1]", or "col = invcolor['blue']" etc.
>> Type: 'invcolor' to see its definition.
>>
>> [Vorher gesicherter Workspace wiederhergestellt]
>>
>>  
>>> library(zoo)
>>>    
>>
>> Attache Paket: 'zoo'
>>
>>
>> The following object(s) are masked from package:base :
>>
>> as.Date.numeric
>>
>>  
>>> sessionInfo()
>>>    
>> R version 2.8.0 (2008-10-20)
>> 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] stats     graphics  utils     datasets  grDevices
>methods   base    
>>
>> other attached packages:
>> [1] zoo_1.5-4
>>
>> loaded via a namespace (and not attached):
>> [1] grid_2.8.0      lattice_0.17-15
>>  
>>> search()
>>>    
>>  [1] ".GlobalEnv"        "package:zoo"       "package:stats"    
>>  [4] "package:graphics"  "package:utils"     "package:datasets"
>>  [7] "package:grDevices" "package:methods"   "Autoloads"        
>> [10] "package:base"    
>>  
>>> packageDescription("zoo")
>>>    
>> Package: zoo
>> Version: 1.5-4
>> Date: 2008-07-09
>> Title: Z's ordered observations
>> Author: Achim Zeileis, Gabor Grothendieck
>> Maintainer: Achim Zeileis <[hidden email]>
>> Description: An S3 class with methods for totally ordered indexed
>>         observations. It is particularly aimed at irregular
>time series
>>         of numeric vectors/matrices and factors. zoo's key
>design goals
>>         are independence of a particular index/date/time class and
>>         consistency with with ts and base R by providing methods to
>>         extend standard generics.
>> Depends: R (>= 2.4.1), stats
>> Suggests: chron, fCalendar, fSeries, its, tseries, lattice,
>>         strucchange, DAAG, xts
>> Imports: stats, utils, graphics, grDevices, lattice
>> LazyLoad: yes
>> License: GPL-2
>> URL: http://R-Forge.R-project.org/projects/zoo/
>> Packaged: Wed Jul 9 18:28:07 2008; zeileis
>> Built: R 2.8.0; ; 2008-10-16 00:01:11; windows
>>
>> -- File: C:/R/package/zoo/Meta/package.rds
>>  
>>> data(EuStockMarkets)
>>> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>>> daxr <- diff(log(dax))
>>> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>>>    
>> [1] TRUE
>> Warning messages:
>> 1: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>> 2: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>>  
>>> qqnorm(coredata(daxr))
>>> qqnorm(daxr)
>>>    
>> Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>   Argument hat Länge 0
>> Calls: qqnorm ... xtfrm.default -> as.vector -> rank -> switch -> .gt
>> Ausführung angehalten
>>
>>
>>  
>>> Dear list-reader,
>>>
>>> by running the following script:
>>>
>>> library(zoo)
>>> sessionInfo()
>>> search()
>>> packageDescription("zoo")
>>> data(EuStockMarkets)
>>> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>>> daxr <- diff(log(dax))
>>> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>>> qqnorm(coredata(daxr))
>>> qqnorm(daxr)
>>>
>>>
>>> qqnorm() produces an error:
>>>
>>>    
>>>> qqnorm(daxr)
>>>>      
>>> Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>  Argument hat Länge 0
>>> Calls: qqnorm ... xtfrm.default -> as.vector -> rank ->
>switch -> .gt
>>> Ausführung angehalten
>>>
>>>
>>> However, this is not witnessed by running the script through R
>>> 2.7.2 (attached are the two output files). Incidentally, the
>>> QQ-plot is produced if one uses "qqnorm(coredata(daxr))" under
>>> R version 2.8.0. After having read both NEWS on CRAN (General
>>> and Windows specific) I still could not figure out what causes
>>> this result. The version of package zoo is the same and the
>>> results do not change if I use the zoo package built under R
>>> version 2.7.2 with R version 2.7.2 or the one that has been
>>> built under R version 2.8.0.
>>>
>>> Any hints and enlightenment are most welcome.
>>>
>>> Best,
>>> Bernhard
>>>
>>>
>>> *****************************************************************
>>> Confidentiality Note: The information contained in this message,
>>> and any attachments, may contain confidential and/or privileged
>>> material. It is intended solely for the person(s) or entity to
>>> which it is addressed. Any review, retransmission, dissemination,
>>> or taking of any action in reliance upon this information by
>>> persons or entities other than the intended recipient(s) is
>>> prohibited. If you received this in error, please contact the
>>> sender and delete the material from any computer.
>>> *****************************************************************
>>>
>>>    
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>  
>
>
>--
>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
> (*) \(*) -- University of Copenhagen   Denmark      Ph:  
>(+45) 35327918
>~~~~~~~~~~ - ([hidden email])              FAX:
>(+45) 35327907
>
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Gabor Grothendieck
In reply to this post by Peter Dalgaard
xtfrm.zoo has been added to the development version of zoo and should
address this.  It is available on R-Forge or in the meantime you can just
add this line to your code:

xtfrm.zoo <- coredata


On Wed, Oct 22, 2008 at 8:49 AM, Peter Dalgaard
<[hidden email]> wrote:

> Pfaff, Bernhard Dr. wrote:
>> It seems, that in my previous emails the attached output files got deleted, hence these are now copied below:
>>
>>
> (If the MIME type is wrong, then that will happen.)
>
> Anyways, the root cause seems to be the new function .gt() which is
> related to
>
>    o   New generic function xtfrm() as an auxiliary helper for
>        sort(), order() and rank().  This should return a numeric
>        vector that sorts in the same way as its input.  The default
>        method supports any class with ==, > and is.na() methods but
>        specific methods can be much faster.
>
>        As a side-effect, rank() will now work better on classed
>        objects, although possibly rather slowly.
>
> Here, "better" may be in the eyes of the beholder, for
>
>> dax[3]==dax[6]
> Data:
> logical(0)
>
> Index:
> integer(0)
>
> and accordingly
>
>> rank(dax)
> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>  argument is of length zero
>
> which is the error that you are seeing.
>
> What to do about it is a bit dubious. Obviously, we don't want to "fix"
> .gt() so that it automatically unclasses objects, and I assume that zoo
> has its reasons for not wanting to compare series with different
> indices. So I suppose that either the user must unclass, or zoo define
> rank.zoo.
>
>> For R version 2.7.2:
>> ====================
>> R version 2.7.2 (2008-08-25)
>> Copyright (C) 2008 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>>
>> R ist freie Software und kommt OHNE JEGLICHE GARANTIE.
>> Sie sind eingeladen, es unter bestimmten Bedingungen weiter zu verbreiten.
>> Tippen Sie 'license()' or 'licence()' für Details dazu.
>>
>> R ist ein Gemeinschaftsprojekt mit vielen Beitragenden.
>> Tippen Sie 'contributors()' für mehr Information und 'citation()',
>> um zu erfahren, wie R oder R packages in Publikationen zitiert werden können.
>>
>> Tippen Sie 'demo()' für einige Demos, 'help()' für on-line Hilfe, oder
>> 'help.start()' für eine HTML Browserschnittstelle zur Hilfe.
>> Tippen Sie 'q()', um R zu verlassen.
>>
>>
>> Invesco colors have been created!
>> Usage: "col = invcolor[1]", or "col = invcolor['blue']" etc.
>> Type: 'invcolor' to see its definition.
>>
>> [Vorher gesicherter Workspace wiederhergestellt]
>>
>>
>>> library(zoo)
>>>
>>
>> Attache Paket: 'zoo'
>>
>>
>>       The following object(s) are masked from package:base :
>>
>>        as.Date.numeric
>>
>> Warning message:
>> Paket 'zoo' wurde unter R Version 2.8.0 gebaut
>>
>>> sessionInfo()
>>>
>> R version 2.7.2 (2008-08-25)
>> 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] stats     graphics  utils     datasets  grDevices methods   base
>>
>> other attached packages:
>> [1] zoo_1.5-4
>>
>> loaded via a namespace (and not attached):
>> [1] grid_2.7.2      lattice_0.17-13
>>
>>> search()
>>>
>>  [1] ".GlobalEnv"        "package:zoo"       "package:stats"
>>  [4] "package:graphics"  "package:utils"     "package:datasets"
>>  [7] "package:grDevices" "package:methods"   "Autoloads"
>> [10] "package:base"
>>
>>> packageDescription("zoo")
>>>
>> Package: zoo
>> Version: 1.5-4
>> Date: 2008-07-09
>> Title: Z's ordered observations
>> Author: Achim Zeileis, Gabor Grothendieck
>> Maintainer: Achim Zeileis <[hidden email]>
>> Description: An S3 class with methods for totally ordered indexed
>>         observations. It is particularly aimed at irregular time series
>>         of numeric vectors/matrices and factors. zoo's key design goals
>>         are independence of a particular index/date/time class and
>>         consistency with with ts and base R by providing methods to
>>         extend standard generics.
>> Depends: R (>= 2.4.1), stats
>> Suggests: chron, fCalendar, fSeries, its, tseries, lattice,
>>         strucchange, DAAG, xts
>> Imports: stats, utils, graphics, grDevices, lattice
>> LazyLoad: yes
>> License: GPL-2
>> URL: http://R-Forge.R-project.org/projects/zoo/
>> Packaged: Wed Jul 9 18:28:07 2008; zeileis
>> Built: R 2.8.0; ; 2008-10-16 00:01:11; windows
>>
>> -- File: C:/R/package/zoo/Meta/package.rds
>>
>>> data(EuStockMarkets)
>>> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>>> daxr <- diff(log(dax))
>>> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>>>
>> [1] TRUE
>> Warning messages:
>> 1: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>> 2: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>>
>>> qqnorm(coredata(daxr))
>>> qqnorm(daxr)
>>>
>>> proc.time()
>>>
>>        User      System verstrichen
>>        1.65        0.13        2.97
>>
>> For R version 2.8.0:
>> ====================
>>  version 2.8.0 (2008-10-20)
>> Copyright (C) 2008 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>>
>> R ist freie Software und kommt OHNE JEGLICHE GARANTIE.
>> Sie sind eingeladen, es unter bestimmten Bedingungen weiter zu verbreiten.
>> Tippen Sie 'license()' or 'licence()' für Details dazu.
>>
>> R ist ein Gemeinschaftsprojekt mit vielen Beitragenden.
>> Tippen Sie 'contributors()' für mehr Information und 'citation()',
>> um zu erfahren, wie R oder R packages in Publikationen zitiert werden können.
>>
>> Tippen Sie 'demo()' für einige Demos, 'help()' für on-line Hilfe, oder
>> 'help.start()' für eine HTML Browserschnittstelle zur Hilfe.
>> Tippen Sie 'q()', um R zu verlassen.
>>
>>
>> Invesco colors have been created!
>> Usage: "col = invcolor[1]", or "col = invcolor['blue']" etc.
>> Type: 'invcolor' to see its definition.
>>
>> [Vorher gesicherter Workspace wiederhergestellt]
>>
>>
>>> library(zoo)
>>>
>>
>> Attache Paket: 'zoo'
>>
>>
>>       The following object(s) are masked from package:base :
>>
>>        as.Date.numeric
>>
>>
>>> sessionInfo()
>>>
>> R version 2.8.0 (2008-10-20)
>> 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] stats     graphics  utils     datasets  grDevices methods   base
>>
>> other attached packages:
>> [1] zoo_1.5-4
>>
>> loaded via a namespace (and not attached):
>> [1] grid_2.8.0      lattice_0.17-15
>>
>>> search()
>>>
>>  [1] ".GlobalEnv"        "package:zoo"       "package:stats"
>>  [4] "package:graphics"  "package:utils"     "package:datasets"
>>  [7] "package:grDevices" "package:methods"   "Autoloads"
>> [10] "package:base"
>>
>>> packageDescription("zoo")
>>>
>> Package: zoo
>> Version: 1.5-4
>> Date: 2008-07-09
>> Title: Z's ordered observations
>> Author: Achim Zeileis, Gabor Grothendieck
>> Maintainer: Achim Zeileis <[hidden email]>
>> Description: An S3 class with methods for totally ordered indexed
>>         observations. It is particularly aimed at irregular time series
>>         of numeric vectors/matrices and factors. zoo's key design goals
>>         are independence of a particular index/date/time class and
>>         consistency with with ts and base R by providing methods to
>>         extend standard generics.
>> Depends: R (>= 2.4.1), stats
>> Suggests: chron, fCalendar, fSeries, its, tseries, lattice,
>>         strucchange, DAAG, xts
>> Imports: stats, utils, graphics, grDevices, lattice
>> LazyLoad: yes
>> License: GPL-2
>> URL: http://R-Forge.R-project.org/projects/zoo/
>> Packaged: Wed Jul 9 18:28:07 2008; zeileis
>> Built: R 2.8.0; ; 2008-10-16 00:01:11; windows
>>
>> -- File: C:/R/package/zoo/Meta/package.rds
>>
>>> data(EuStockMarkets)
>>> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>>> daxr <- diff(log(dax))
>>> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>>>
>> [1] TRUE
>> Warning messages:
>> 1: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>> 2: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs wurden erzeugt
>>
>>> qqnorm(coredata(daxr))
>>> qqnorm(daxr)
>>>
>> Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>   Argument hat Länge 0
>> Calls: qqnorm ... xtfrm.default -> as.vector -> rank -> switch -> .gt
>> Ausführung angehalten
>>
>>
>>
>>> Dear list-reader,
>>>
>>> by running the following script:
>>>
>>> library(zoo)
>>> sessionInfo()
>>> search()
>>> packageDescription("zoo")
>>> data(EuStockMarkets)
>>> dax <- as.zoo(EuStockMarkets[1:10, "DAX"])
>>> daxr <- diff(log(dax))
>>> identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
>>> qqnorm(coredata(daxr))
>>> qqnorm(daxr)
>>>
>>>
>>> qqnorm() produces an error:
>>>
>>>
>>>> qqnorm(daxr)
>>>>
>>> Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>  Argument hat Länge 0
>>> Calls: qqnorm ... xtfrm.default -> as.vector -> rank -> switch -> .gt
>>> Ausführung angehalten
>>>
>>>
>>> However, this is not witnessed by running the script through R
>>> 2.7.2 (attached are the two output files). Incidentally, the
>>> QQ-plot is produced if one uses "qqnorm(coredata(daxr))" under
>>> R version 2.8.0. After having read both NEWS on CRAN (General
>>> and Windows specific) I still could not figure out what causes
>>> this result. The version of package zoo is the same and the
>>> results do not change if I use the zoo package built under R
>>> version 2.7.2 with R version 2.7.2 or the one that has been
>>> built under R version 2.8.0.
>>>
>>> Any hints and enlightenment are most welcome.
>>>
>>> Best,
>>> Bernhard
>>>
>>>
>>> *****************************************************************
>>> Confidentiality Note: The information contained in this message,
>>> and any attachments, may contain confidential and/or privileged
>>> material. It is intended solely for the person(s) or entity to
>>> which it is addressed. Any review, retransmission, dissemination,
>>> or taking of any action in reliance upon this information by
>>> persons or entities other than the intended recipient(s) is
>>> prohibited. If you received this in error, please contact the
>>> sender and delete the material from any computer.
>>> *****************************************************************
>>>
>>>
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>
> --
>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
> ~~~~~~~~~~ - ([hidden email])              FAX: (+45) 35327907
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Achim Zeileis-2
In reply to this post by Pfaff, Bernhard Dr.
On Wed, 22 Oct 2008, Pfaff, Bernhard Dr. wrote:

> Dear Peter,
>
> many thanks for your swift reply and the enlightenment; much appreciated.
> I have cc'ed Achim as the package maintainer of zoo,

...and I have added Gabor, just in case.

> in case this thread should have slipt his notice. Just curious, Achim,
> will there be a rank.zoo() function in a future release of your package?

I'm not sure - my first reaction would be "no". With time series, there
might be confusion between sorting/ordering/ranking with respect to the
observations vs. with respect to the time index. To clarify that you want
some operation with respect to the data, you can easily say
   sort(coredata(z))
etc. This is rather evocative and not that much longer to type than
sort(z). And it would be unclear what the latter should mean exactly.

In the case of rank(z), one could argue that it is meaningful...but
providing rank() without sort() or order() methods might again be
confusing. My first impression would be that the cons outweigh the pros.
Z

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Gabor Grothendieck
In reply to this post by Peter Dalgaard
On Wed, Oct 22, 2008 at 8:49 AM, Peter Dalgaard
<[hidden email]> wrote:

> Pfaff, Bernhard Dr. wrote:
>> It seems, that in my previous emails the attached output files got deleted, hence these are now copied below:
>>
>>
> (If the MIME type is wrong, then that will happen.)
>
> Anyways, the root cause seems to be the new function .gt() which is
> related to
>
>    o   New generic function xtfrm() as an auxiliary helper for
>        sort(), order() and rank().  This should return a numeric
>        vector that sorts in the same way as its input.  The default
>        method supports any class with ==, > and is.na() methods but
>        specific methods can be much faster.
>
>        As a side-effect, rank() will now work better on classed
>        objects, although possibly rather slowly.
>
> Here, "better" may be in the eyes of the beholder, for
>
>> dax[3]==dax[6]
> Data:
> logical(0)
>
> Index:
> integer(0)
>
> and accordingly
>
>> rank(dax)
> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>  argument is of length zero
>
> which is the error that you are seeing.
>
> What to do about it is a bit dubious. Obviously, we don't want to "fix"
> .gt() so that it automatically unclasses objects, and I assume that zoo
> has its reasons for not wanting to compare series with different
> indices. So I suppose that either the user must unclass, or zoo define
> rank.zoo.

Actually qqnorm does not use rank but it does use order and with the
xtfrm.zoo method I mentioned qqnorm works with zoo; however, I think
rank needs to be fixed in R to make use of xtfrm as well since I would have
expected that supplying an xtfrm method for zoo would be sufficient to
get both order and rank to work without giving errors.  Also note that rank
is not generic.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Peter Dalgaard
Gabor Grothendieck wrote:

> On Wed, Oct 22, 2008 at 8:49 AM, Peter Dalgaard
> <[hidden email]> wrote:
>  
>> Pfaff, Bernhard Dr. wrote:
>>    
>>> It seems, that in my previous emails the attached output files got deleted, hence these are now copied below:
>>>
>>>
>>>      
>> (If the MIME type is wrong, then that will happen.)
>>
>> Anyways, the root cause seems to be the new function .gt() which is
>> related to
>>
>>    o   New generic function xtfrm() as an auxiliary helper for
>>        sort(), order() and rank().  This should return a numeric
>>        vector that sorts in the same way as its input.  The default
>>        method supports any class with ==, > and is.na() methods but
>>        specific methods can be much faster.
>>
>>        As a side-effect, rank() will now work better on classed
>>        objects, although possibly rather slowly.
>>
>> Here, "better" may be in the eyes of the beholder, for
>>
>>    
>>> dax[3]==dax[6]
>>>      
>> Data:
>> logical(0)
>>
>> Index:
>> integer(0)
>>
>> and accordingly
>>
>>    
>>> rank(dax)
>>>      
>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>  argument is of length zero
>>
>> which is the error that you are seeing.
>>
>> What to do about it is a bit dubious. Obviously, we don't want to "fix"
>> .gt() so that it automatically unclasses objects, and I assume that zoo
>> has its reasons for not wanting to compare series with different
>> indices. So I suppose that either the user must unclass, or zoo define
>> rank.zoo.
>>    
>
> Actually qqnorm does not use rank but it does use order and with the
> xtfrm.zoo method I mentioned qqnorm works with zoo; however, I think
> rank needs to be fixed in R to make use of xtfrm as well since I would have
> expected that supplying an xtfrm method for zoo would be sufficient to
> get both order and rank to work without giving errors.  Also note that rank
> is not generic.
>  
Notice that xtfrm.default() uses rank()....

--
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])              FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Gabor Grothendieck
Yes, I noticed that but rank is not generic.  An xtfrm.zoo
method has been added to zoo on R-Forge but rank still
fails:

> R.version.string
[1] "R version 2.8.0 Patched (2008-10-21 r46766)"
> packageDescription("zoo")$Version
[1] "1.5-3"
> library(zoo)
> # next line adds xtfrm zoo method
> xtfrm.zoo <- coredata
> z <- zoo(1:4)
> order(z) # ok
[1] 1 2 3 4
> qqnorm(z) # ok
> rank(z) # error
Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
  argument is of length zero


>>>>
>>> (If the MIME type is wrong, then that will happen.)
>>>
>>> Anyways, the root cause seems to be the new function .gt() which is
>>> related to
>>>
>>>    o   New generic function xtfrm() as an auxiliary helper for
>>>        sort(), order() and rank().  This should return a numeric
>>>        vector that sorts in the same way as its input.  The default
>>>        method supports any class with ==, > and is.na() methods but
>>>        specific methods can be much faster.
>>>
>>>        As a side-effect, rank() will now work better on classed
>>>        objects, although possibly rather slowly.
>>>
>>> Here, "better" may be in the eyes of the beholder, for
>>>
>>>
>>>> dax[3]==dax[6]
>>>>
>>> Data:
>>> logical(0)
>>>
>>> Index:
>>> integer(0)
>>>
>>> and accordingly
>>>
>>>
>>>> rank(dax)
>>>>
>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>  argument is of length zero
>>>
>>> which is the error that you are seeing.
>>>
>>> What to do about it is a bit dubious. Obviously, we don't want to "fix"
>>> .gt() so that it automatically unclasses objects, and I assume that zoo
>>> has its reasons for not wanting to compare series with different
>>> indices. So I suppose that either the user must unclass, or zoo define
>>> rank.zoo.
>>>
>>
>> Actually qqnorm does not use rank but it does use order and with the
>> xtfrm.zoo method I mentioned qqnorm works with zoo; however, I think
>> rank needs to be fixed in R to make use of xtfrm as well since I would have
>> expected that supplying an xtfrm method for zoo would be sufficient to
>> get both order and rank to work without giving errors.  Also note that rank
>> is not generic.
>>
> Notice that xtfrm.default() uses rank()....
>
> --
>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
> ~~~~~~~~~~ - ([hidden email])              FAX: (+45) 35327907
>
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Gabor Grothendieck
And one other point.

z <- zoo(1:4)
.gt(z, 1, 2)

fails because z[1] and z[2] are at different time points so

   z[1] == z[2]

is logical(0) because when zoo compares objects it aligns them
first.

On Wed, Oct 22, 2008 at 2:19 PM, Gabor Grothendieck
<[hidden email]> wrote:

> Yes, I noticed that but rank is not generic.  An xtfrm.zoo
> method has been added to zoo on R-Forge but rank still
> fails:
>
>> R.version.string
> [1] "R version 2.8.0 Patched (2008-10-21 r46766)"
>> packageDescription("zoo")$Version
> [1] "1.5-3"
>> library(zoo)
>> # next line adds xtfrm zoo method
>> xtfrm.zoo <- coredata
>> z <- zoo(1:4)
>> order(z) # ok
> [1] 1 2 3 4
>> qqnorm(z) # ok
>> rank(z) # error
> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>  argument is of length zero
>
>
>>>>>
>>>> (If the MIME type is wrong, then that will happen.)
>>>>
>>>> Anyways, the root cause seems to be the new function .gt() which is
>>>> related to
>>>>
>>>>    o   New generic function xtfrm() as an auxiliary helper for
>>>>        sort(), order() and rank().  This should return a numeric
>>>>        vector that sorts in the same way as its input.  The default
>>>>        method supports any class with ==, > and is.na() methods but
>>>>        specific methods can be much faster.
>>>>
>>>>        As a side-effect, rank() will now work better on classed
>>>>        objects, although possibly rather slowly.
>>>>
>>>> Here, "better" may be in the eyes of the beholder, for
>>>>
>>>>
>>>>> dax[3]==dax[6]
>>>>>
>>>> Data:
>>>> logical(0)
>>>>
>>>> Index:
>>>> integer(0)
>>>>
>>>> and accordingly
>>>>
>>>>
>>>>> rank(dax)
>>>>>
>>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>>  argument is of length zero
>>>>
>>>> which is the error that you are seeing.
>>>>
>>>> What to do about it is a bit dubious. Obviously, we don't want to "fix"
>>>> .gt() so that it automatically unclasses objects, and I assume that zoo
>>>> has its reasons for not wanting to compare series with different
>>>> indices. So I suppose that either the user must unclass, or zoo define
>>>> rank.zoo.
>>>>
>>>
>>> Actually qqnorm does not use rank but it does use order and with the
>>> xtfrm.zoo method I mentioned qqnorm works with zoo; however, I think
>>> rank needs to be fixed in R to make use of xtfrm as well since I would have
>>> expected that supplying an xtfrm method for zoo would be sufficient to
>>> get both order and rank to work without giving errors.  Also note that rank
>>> is not generic.
>>>
>> Notice that xtfrm.default() uses rank()....
>>
>> --
>>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
>> ~~~~~~~~~~ - ([hidden email])              FAX: (+45) 35327907
>>
>>
>>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Peter Dalgaard
Gabor Grothendieck wrote:

> And one other point.
>
> z <- zoo(1:4)
> .gt(z, 1, 2)
>
> fails because z[1] and z[2] are at different time points so
>
>    z[1] == z[2]
>
> is logical(0) because when zoo compares objects it aligns them
> first.

Yes, that was the point that I was trying to make. Well, arguably it
doesn't "fail", it just does what it is supposed to do. Things would
"work" with [[ or a preceding unclass(z), but that would break
comparisons involving, say, POSIXlt objects. So you're sort of stuck
between a rock and a hard place.

>
> On Wed, Oct 22, 2008 at 2:19 PM, Gabor Grothendieck
> <[hidden email]> wrote:
>> Yes, I noticed that but rank is not generic.  An xtfrm.zoo
>> method has been added to zoo on R-Forge but rank still
>> fails:
>>
>>> R.version.string
>> [1] "R version 2.8.0 Patched (2008-10-21 r46766)"
>>> packageDescription("zoo")$Version
>> [1] "1.5-3"
>>> library(zoo)
>>> # next line adds xtfrm zoo method
>>> xtfrm.zoo <- coredata
>>> z <- zoo(1:4)
>>> order(z) # ok
>> [1] 1 2 3 4
>>> qqnorm(z) # ok
>>> rank(z) # error
>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>  argument is of length zero
>>
>>
>>>>> (If the MIME type is wrong, then that will happen.)
>>>>>
>>>>> Anyways, the root cause seems to be the new function .gt() which is
>>>>> related to
>>>>>
>>>>>    o   New generic function xtfrm() as an auxiliary helper for
>>>>>        sort(), order() and rank().  This should return a numeric
>>>>>        vector that sorts in the same way as its input.  The default
>>>>>        method supports any class with ==, > and is.na() methods but
>>>>>        specific methods can be much faster.
>>>>>
>>>>>        As a side-effect, rank() will now work better on classed
>>>>>        objects, although possibly rather slowly.
>>>>>
>>>>> Here, "better" may be in the eyes of the beholder, for
>>>>>
>>>>>
>>>>>> dax[3]==dax[6]
>>>>>>
>>>>> Data:
>>>>> logical(0)
>>>>>
>>>>> Index:
>>>>> integer(0)
>>>>>
>>>>> and accordingly
>>>>>
>>>>>
>>>>>> rank(dax)
>>>>>>
>>>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>>>  argument is of length zero
>>>>>
>>>>> which is the error that you are seeing.
>>>>>
>>>>> What to do about it is a bit dubious. Obviously, we don't want to "fix"
>>>>> .gt() so that it automatically unclasses objects, and I assume that zoo
>>>>> has its reasons for not wanting to compare series with different
>>>>> indices. So I suppose that either the user must unclass, or zoo define
>>>>> rank.zoo.
>>>>>
>>>> Actually qqnorm does not use rank but it does use order and with the
>>>> xtfrm.zoo method I mentioned qqnorm works with zoo; however, I think
>>>> rank needs to be fixed in R to make use of xtfrm as well since I would have
>>>> expected that supplying an xtfrm method for zoo would be sufficient to
>>>> get both order and rank to work without giving errors.  Also note that rank
>>>> is not generic.
>>>>
>>> Notice that xtfrm.default() uses rank()....
>>>
>>> --
>>>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
>>> ~~~~~~~~~~ - ([hidden email])              FAX: (+45) 35327907
>>>
>>>
>>>


--
    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])              FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Gabor Grothendieck
I don't think its hopeless.  order works ok provided the underlying class
defines an xtfrm method.  I think rank should follow that route too.  Its
arguably the inconsistency between rank and order (order but not the
rank uses xtfrm) that causes the inconsistent behavior between the two.
If rank were also built on top of xtfrm then it would work as desired as
well.

On Wed, Oct 22, 2008 at 5:03 PM, Peter Dalgaard
<[hidden email]> wrote:

> Gabor Grothendieck wrote:
>>
>> And one other point.
>>
>> z <- zoo(1:4)
>> .gt(z, 1, 2)
>>
>> fails because z[1] and z[2] are at different time points so
>>
>>   z[1] == z[2]
>>
>> is logical(0) because when zoo compares objects it aligns them
>> first.
>
> Yes, that was the point that I was trying to make. Well, arguably it doesn't
> "fail", it just does what it is supposed to do. Things would "work" with [[
> or a preceding unclass(z), but that would break comparisons involving, say,
> POSIXlt objects. So you're sort of stuck between a rock and a hard place.
>
>>
>> On Wed, Oct 22, 2008 at 2:19 PM, Gabor Grothendieck
>> <[hidden email]> wrote:
>>>
>>> Yes, I noticed that but rank is not generic.  An xtfrm.zoo
>>> method has been added to zoo on R-Forge but rank still
>>> fails:
>>>
>>>> R.version.string
>>>
>>> [1] "R version 2.8.0 Patched (2008-10-21 r46766)"
>>>>
>>>> packageDescription("zoo")$Version
>>>
>>> [1] "1.5-3"
>>>>
>>>> library(zoo)
>>>> # next line adds xtfrm zoo method
>>>> xtfrm.zoo <- coredata
>>>> z <- zoo(1:4)
>>>> order(z) # ok
>>>
>>> [1] 1 2 3 4
>>>>
>>>> qqnorm(z) # ok
>>>> rank(z) # error
>>>
>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>  argument is of length zero
>>>
>>>
>>>>>> (If the MIME type is wrong, then that will happen.)
>>>>>>
>>>>>> Anyways, the root cause seems to be the new function .gt() which is
>>>>>> related to
>>>>>>
>>>>>>   o   New generic function xtfrm() as an auxiliary helper for
>>>>>>       sort(), order() and rank().  This should return a numeric
>>>>>>       vector that sorts in the same way as its input.  The default
>>>>>>       method supports any class with ==, > and is.na() methods but
>>>>>>       specific methods can be much faster.
>>>>>>
>>>>>>       As a side-effect, rank() will now work better on classed
>>>>>>       objects, although possibly rather slowly.
>>>>>>
>>>>>> Here, "better" may be in the eyes of the beholder, for
>>>>>>
>>>>>>
>>>>>>> dax[3]==dax[6]
>>>>>>>
>>>>>> Data:
>>>>>> logical(0)
>>>>>>
>>>>>> Index:
>>>>>> integer(0)
>>>>>>
>>>>>> and accordingly
>>>>>>
>>>>>>
>>>>>>> rank(dax)
>>>>>>>
>>>>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>>>>  argument is of length zero
>>>>>>
>>>>>> which is the error that you are seeing.
>>>>>>
>>>>>> What to do about it is a bit dubious. Obviously, we don't want to
>>>>>> "fix"
>>>>>> .gt() so that it automatically unclasses objects, and I assume that
>>>>>> zoo
>>>>>> has its reasons for not wanting to compare series with different
>>>>>> indices. So I suppose that either the user must unclass, or zoo define
>>>>>> rank.zoo.
>>>>>>
>>>>> Actually qqnorm does not use rank but it does use order and with the
>>>>> xtfrm.zoo method I mentioned qqnorm works with zoo; however, I think
>>>>> rank needs to be fixed in R to make use of xtfrm as well since I would
>>>>> have
>>>>> expected that supplying an xtfrm method for zoo would be sufficient to
>>>>> get both order and rank to work without giving errors.  Also note that
>>>>> rank
>>>>> is not generic.
>>>>>
>>>> Notice that xtfrm.default() uses rank()....
>>>>
>>>> --
>>>>  O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
>>>> ~~~~~~~~~~ - ([hidden email])              FAX: (+45) 35327907
>>>>
>>>>
>>>>
>
>
> --
>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
> ~~~~~~~~~~ - ([hidden email])              FAX: (+45) 35327907
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Pfaff, Bernhard Dr.
Dear Achim, Gabor, Jeff, Peter and remaining list-subscribers,

first, please accept my apologies for having started this thread. Given the avalanche of responses (some off-list) and the associated time stamps, some of you have almost pulled an all-nighter about this topic. I might have not have started this thread in the first place, if I would have known this.

I agree with Achim's view that a "not working for zoo objects" strategy is preferable compared to a "half-working for zoo objects" strategy.  I do not have either a problem by employing coredata(z) when necessary. Now, Gabor, you pointed out nicely that the culprit, namely that order() resides on top of xtfrm whereas rank() does not (this was voiced by you in an email to Peter and R-Devel, hence I inlucde these recipients again in this thread and the reason for doing this is also motivated by the following proposition):

You further pointed out that the problems wrt to rank and zoo-objects could be solved if rank() would, like order() does, reside on top of xtfrm. My question/proposal would then be to follow this approach, i.e. use xtfrm in rank. Now, I am not that deep into R nor an expert to judge whether this would cause problems/breaking existing R code in other instances; hence I appreciate feedback if this would be a feasible/desirable change in R-Devel.


Best,
Bernhard

>-----Ursprüngliche Nachricht-----
>Von: Gabor Grothendieck [mailto:[hidden email]]
>Gesendet: Donnerstag, 23. Oktober 2008 02:36
>An: Peter Dalgaard
>Cc: Pfaff, Bernhard Dr.; [hidden email]
>Betreff: Re: [Rd] R 2.8.0 qqnorm produces error with object of
>class zoo?
>
>I don't think its hopeless.  order works ok provided the
>underlying class
>defines an xtfrm method.  I think rank should follow that
>route too.  Its
>arguably the inconsistency between rank and order (order but not the
>rank uses xtfrm) that causes the inconsistent behavior between the two.
>If rank were also built on top of xtfrm then it would work as
>desired as
>well.
>
>On Wed, Oct 22, 2008 at 5:03 PM, Peter Dalgaard
><[hidden email]> wrote:
>> Gabor Grothendieck wrote:
>>>
>>> And one other point.
>>>
>>> z <- zoo(1:4)
>>> .gt(z, 1, 2)
>>>
>>> fails because z[1] and z[2] are at different time points so
>>>
>>>   z[1] == z[2]
>>>
>>> is logical(0) because when zoo compares objects it aligns them
>>> first.
>>
>> Yes, that was the point that I was trying to make. Well,
>arguably it doesn't
>> "fail", it just does what it is supposed to do. Things would
>"work" with [[
>> or a preceding unclass(z), but that would break comparisons
>involving, say,
>> POSIXlt objects. So you're sort of stuck between a rock and
>a hard place.
>>
>>>
>>> On Wed, Oct 22, 2008 at 2:19 PM, Gabor Grothendieck
>>> <[hidden email]> wrote:
>>>>
>>>> Yes, I noticed that but rank is not generic.  An xtfrm.zoo
>>>> method has been added to zoo on R-Forge but rank still
>>>> fails:
>>>>
>>>>> R.version.string
>>>>
>>>> [1] "R version 2.8.0 Patched (2008-10-21 r46766)"
>>>>>
>>>>> packageDescription("zoo")$Version
>>>>
>>>> [1] "1.5-3"
>>>>>
>>>>> library(zoo)
>>>>> # next line adds xtfrm zoo method
>>>>> xtfrm.zoo <- coredata
>>>>> z <- zoo(1:4)
>>>>> order(z) # ok
>>>>
>>>> [1] 1 2 3 4
>>>>>
>>>>> qqnorm(z) # ok
>>>>> rank(z) # error
>>>>
>>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>>  argument is of length zero
>>>>
>>>>
>>>>>>> (If the MIME type is wrong, then that will happen.)
>>>>>>>
>>>>>>> Anyways, the root cause seems to be the new function
>.gt() which is
>>>>>>> related to
>>>>>>>
>>>>>>>   o   New generic function xtfrm() as an auxiliary helper for
>>>>>>>       sort(), order() and rank().  This should return a numeric
>>>>>>>       vector that sorts in the same way as its input.  
>The default
>>>>>>>       method supports any class with ==, > and is.na()
>methods but
>>>>>>>       specific methods can be much faster.
>>>>>>>
>>>>>>>       As a side-effect, rank() will now work better on classed
>>>>>>>       objects, although possibly rather slowly.
>>>>>>>
>>>>>>> Here, "better" may be in the eyes of the beholder, for
>>>>>>>
>>>>>>>
>>>>>>>> dax[3]==dax[6]
>>>>>>>>
>>>>>>> Data:
>>>>>>> logical(0)
>>>>>>>
>>>>>>> Index:
>>>>>>> integer(0)
>>>>>>>
>>>>>>> and accordingly
>>>>>>>
>>>>>>>
>>>>>>>> rank(dax)
>>>>>>>>
>>>>>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>>>>>  argument is of length zero
>>>>>>>
>>>>>>> which is the error that you are seeing.
>>>>>>>
>>>>>>> What to do about it is a bit dubious. Obviously, we
>don't want to
>>>>>>> "fix"
>>>>>>> .gt() so that it automatically unclasses objects, and I
>assume that
>>>>>>> zoo
>>>>>>> has its reasons for not wanting to compare series with different
>>>>>>> indices. So I suppose that either the user must
>unclass, or zoo define
>>>>>>> rank.zoo.
>>>>>>>
>>>>>> Actually qqnorm does not use rank but it does use order
>and with the
>>>>>> xtfrm.zoo method I mentioned qqnorm works with zoo;
>however, I think
>>>>>> rank needs to be fixed in R to make use of xtfrm as well
>since I would
>>>>>> have
>>>>>> expected that supplying an xtfrm method for zoo would be
>sufficient to
>>>>>> get both order and rank to work without giving errors.  
>Also note that
>>>>>> rank
>>>>>> is not generic.
>>>>>>
>>>>> Notice that xtfrm.default() uses rank()....
>>>>>
>>>>> --
>>>>>  O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>>>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>>>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:  
>(+45) 35327918
>>>>> ~~~~~~~~~~ - ([hidden email])              FAX:
>(+45) 35327907
>>>>>
>>>>>
>>>>>
>>
>>
>> --
>>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:  
>(+45) 35327918
>> ~~~~~~~~~~ - ([hidden email])              FAX:
>(+45) 35327907
>>
>
*****************************************************************
Confidentiality Note: The information contained in this ...{{dropped:10}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Gabor Grothendieck
Based on the quote that Peter gave:

   o   New generic function xtfrm() as an auxiliary helper for
       sort(), order() and rank().  This should return a numeric
       vector that sorts in the same way as its input.  The default
       method supports any class with ==, > and is.na() methods but
       specific methods can be much faster.

       As a side-effect, rank() will now work better on classed
       objects, although possibly rather slowly.

it seems that it was the intention to have rank(x) use x only via xtfrm(x)
but that is not, in fact, how it works as defining xtfrm.zoo still
results in the
discussed error.

On Thu, Oct 23, 2008 at 5:13 AM, Pfaff, Bernhard Dr.
<[hidden email]> wrote:

> Dear Achim, Gabor, Jeff, Peter and remaining list-subscribers,
>
> first, please accept my apologies for having started this thread. Given the avalanche of responses (some off-list) and the associated time stamps, some of you have almost pulled an all-nighter about this topic. I might have not have started this thread in the first place, if I would have known this.
>
> I agree with Achim's view that a "not working for zoo objects" strategy is preferable compared to a "half-working for zoo objects" strategy.  I do not have either a problem by employing coredata(z) when necessary. Now, Gabor, you pointed out nicely that the culprit, namely that order() resides on top of xtfrm whereas rank() does not (this was voiced by you in an email to Peter and R-Devel, hence I inlucde these recipients again in this thread and the reason for doing this is also motivated by the following proposition):
>
> You further pointed out that the problems wrt to rank and zoo-objects could be solved if rank() would, like order() does, reside on top of xtfrm. My question/proposal would then be to follow this approach, i.e. use xtfrm in rank. Now, I am not that deep into R nor an expert to judge whether this would cause problems/breaking existing R code in other instances; hence I appreciate feedback if this would be a feasible/desirable change in R-Devel.
>
>
> Best,
> Bernhard
>
>>-----Ursprüngliche Nachricht-----
>>Von: Gabor Grothendieck [mailto:[hidden email]]
>>Gesendet: Donnerstag, 23. Oktober 2008 02:36
>>An: Peter Dalgaard
>>Cc: Pfaff, Bernhard Dr.; [hidden email]
>>Betreff: Re: [Rd] R 2.8.0 qqnorm produces error with object of
>>class zoo?
>>
>>I don't think its hopeless.  order works ok provided the
>>underlying class
>>defines an xtfrm method.  I think rank should follow that
>>route too.  Its
>>arguably the inconsistency between rank and order (order but not the
>>rank uses xtfrm) that causes the inconsistent behavior between the two.
>>If rank were also built on top of xtfrm then it would work as
>>desired as
>>well.
>>
>>On Wed, Oct 22, 2008 at 5:03 PM, Peter Dalgaard
>><[hidden email]> wrote:
>>> Gabor Grothendieck wrote:
>>>>
>>>> And one other point.
>>>>
>>>> z <- zoo(1:4)
>>>> .gt(z, 1, 2)
>>>>
>>>> fails because z[1] and z[2] are at different time points so
>>>>
>>>>   z[1] == z[2]
>>>>
>>>> is logical(0) because when zoo compares objects it aligns them
>>>> first.
>>>
>>> Yes, that was the point that I was trying to make. Well,
>>arguably it doesn't
>>> "fail", it just does what it is supposed to do. Things would
>>"work" with [[
>>> or a preceding unclass(z), but that would break comparisons
>>involving, say,
>>> POSIXlt objects. So you're sort of stuck between a rock and
>>a hard place.
>>>
>>>>
>>>> On Wed, Oct 22, 2008 at 2:19 PM, Gabor Grothendieck
>>>> <[hidden email]> wrote:
>>>>>
>>>>> Yes, I noticed that but rank is not generic.  An xtfrm.zoo
>>>>> method has been added to zoo on R-Forge but rank still
>>>>> fails:
>>>>>
>>>>>> R.version.string
>>>>>
>>>>> [1] "R version 2.8.0 Patched (2008-10-21 r46766)"
>>>>>>
>>>>>> packageDescription("zoo")$Version
>>>>>
>>>>> [1] "1.5-3"
>>>>>>
>>>>>> library(zoo)
>>>>>> # next line adds xtfrm zoo method
>>>>>> xtfrm.zoo <- coredata
>>>>>> z <- zoo(1:4)
>>>>>> order(z) # ok
>>>>>
>>>>> [1] 1 2 3 4
>>>>>>
>>>>>> qqnorm(z) # ok
>>>>>> rank(z) # error
>>>>>
>>>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>>>  argument is of length zero
>>>>>
>>>>>
>>>>>>>> (If the MIME type is wrong, then that will happen.)
>>>>>>>>
>>>>>>>> Anyways, the root cause seems to be the new function
>>.gt() which is
>>>>>>>> related to
>>>>>>>>
>>>>>>>>   o   New generic function xtfrm() as an auxiliary helper for
>>>>>>>>       sort(), order() and rank().  This should return a numeric
>>>>>>>>       vector that sorts in the same way as its input.
>>The default
>>>>>>>>       method supports any class with ==, > and is.na()
>>methods but
>>>>>>>>       specific methods can be much faster.
>>>>>>>>
>>>>>>>>       As a side-effect, rank() will now work better on classed
>>>>>>>>       objects, although possibly rather slowly.
>>>>>>>>
>>>>>>>> Here, "better" may be in the eyes of the beholder, for
>>>>>>>>
>>>>>>>>
>>>>>>>>> dax[3]==dax[6]
>>>>>>>>>
>>>>>>>> Data:
>>>>>>>> logical(0)
>>>>>>>>
>>>>>>>> Index:
>>>>>>>> integer(0)
>>>>>>>>
>>>>>>>> and accordingly
>>>>>>>>
>>>>>>>>
>>>>>>>>> rank(dax)
>>>>>>>>>
>>>>>>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>>>>>>  argument is of length zero
>>>>>>>>
>>>>>>>> which is the error that you are seeing.
>>>>>>>>
>>>>>>>> What to do about it is a bit dubious. Obviously, we
>>don't want to
>>>>>>>> "fix"
>>>>>>>> .gt() so that it automatically unclasses objects, and I
>>assume that
>>>>>>>> zoo
>>>>>>>> has its reasons for not wanting to compare series with different
>>>>>>>> indices. So I suppose that either the user must
>>unclass, or zoo define
>>>>>>>> rank.zoo.
>>>>>>>>
>>>>>>> Actually qqnorm does not use rank but it does use order
>>and with the
>>>>>>> xtfrm.zoo method I mentioned qqnorm works with zoo;
>>however, I think
>>>>>>> rank needs to be fixed in R to make use of xtfrm as well
>>since I would
>>>>>>> have
>>>>>>> expected that supplying an xtfrm method for zoo would be
>>sufficient to
>>>>>>> get both order and rank to work without giving errors.
>>Also note that
>>>>>>> rank
>>>>>>> is not generic.
>>>>>>>
>>>>>> Notice that xtfrm.default() uses rank()....
>>>>>>
>>>>>> --
>>>>>>  O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>>>>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>>>>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:
>>(+45) 35327918
>>>>>> ~~~~~~~~~~ - ([hidden email])              FAX:
>>(+45) 35327907
>>>>>>
>>>>>>
>>>>>>
>>>
>>>
>>> --
>>>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:
>>(+45) 35327918
>>> ~~~~~~~~~~ - ([hidden email])              FAX:
>>(+45) 35327907
>>>
>>
> *****************************************************************
> Confidentiality Note: The information contained in this message,
> and any attachments, may contain confidential and/or privileged
> material. It is intended solely for the person(s) or entity to
> which it is addressed. Any review, retransmission, dissemination,
> or taking of any action in reliance upon this information by
> persons or entities other than the intended recipient(s) is
> prohibited. If you received this in error, please contact the
> sender and delete the material from any computer.
> *****************************************************************
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R 2.8.0 qqnorm produces error with object of class zoo?

Whit Armstrong-3
sorry, for joining this thread so late. I've just upgraded to R2.8.0
and was hit with the same issue immediately in my fts package.

Has any consensus been reached about how to deal with this issue?

Do I understand correctly that the change to use:

[sort.c: 592]
PROTECT(call = lang4(install(".gt"), x, si, sj));
c = asInteger(eval(call, rho));

inside of "static int equal(int i, int j, SEXP x, Rboolean nalast,
SEXP rho)" was to promote class based object dispatching for
comparisons?

-Whit


On Thu, Oct 23, 2008 at 6:16 AM, Gabor Grothendieck
<[hidden email]> wrote:

> Based on the quote that Peter gave:
>
>   o   New generic function xtfrm() as an auxiliary helper for
>       sort(), order() and rank().  This should return a numeric
>       vector that sorts in the same way as its input.  The default
>       method supports any class with ==, > and is.na() methods but
>       specific methods can be much faster.
>
>       As a side-effect, rank() will now work better on classed
>       objects, although possibly rather slowly.
>
> it seems that it was the intention to have rank(x) use x only via xtfrm(x)
> but that is not, in fact, how it works as defining xtfrm.zoo still
> results in the
> discussed error.
>
> On Thu, Oct 23, 2008 at 5:13 AM, Pfaff, Bernhard Dr.
> <[hidden email]> wrote:
>> Dear Achim, Gabor, Jeff, Peter and remaining list-subscribers,
>>
>> first, please accept my apologies for having started this thread. Given the avalanche of responses (some off-list) and the associated time stamps, some of you have almost pulled an all-nighter about this topic. I might have not have started this thread in the first place, if I would have known this.
>>
>> I agree with Achim's view that a "not working for zoo objects" strategy is preferable compared to a "half-working for zoo objects" strategy.  I do not have either a problem by employing coredata(z) when necessary. Now, Gabor, you pointed out nicely that the culprit, namely that order() resides on top of xtfrm whereas rank() does not (this was voiced by you in an email to Peter and R-Devel, hence I inlucde these recipients again in this thread and the reason for doing this is also motivated by the following proposition):
>>
>> You further pointed out that the problems wrt to rank and zoo-objects could be solved if rank() would, like order() does, reside on top of xtfrm. My question/proposal would then be to follow this approach, i.e. use xtfrm in rank. Now, I am not that deep into R nor an expert to judge whether this would cause problems/breaking existing R code in other instances; hence I appreciate feedback if this would be a feasible/desirable change in R-Devel.
>>
>>
>> Best,
>> Bernhard
>>
>>>-----Ursprüngliche Nachricht-----
>>>Von: Gabor Grothendieck [mailto:[hidden email]]
>>>Gesendet: Donnerstag, 23. Oktober 2008 02:36
>>>An: Peter Dalgaard
>>>Cc: Pfaff, Bernhard Dr.; [hidden email]
>>>Betreff: Re: [Rd] R 2.8.0 qqnorm produces error with object of
>>>class zoo?
>>>
>>>I don't think its hopeless.  order works ok provided the
>>>underlying class
>>>defines an xtfrm method.  I think rank should follow that
>>>route too.  Its
>>>arguably the inconsistency between rank and order (order but not the
>>>rank uses xtfrm) that causes the inconsistent behavior between the two.
>>>If rank were also built on top of xtfrm then it would work as
>>>desired as
>>>well.
>>>
>>>On Wed, Oct 22, 2008 at 5:03 PM, Peter Dalgaard
>>><[hidden email]> wrote:
>>>> Gabor Grothendieck wrote:
>>>>>
>>>>> And one other point.
>>>>>
>>>>> z <- zoo(1:4)
>>>>> .gt(z, 1, 2)
>>>>>
>>>>> fails because z[1] and z[2] are at different time points so
>>>>>
>>>>>   z[1] == z[2]
>>>>>
>>>>> is logical(0) because when zoo compares objects it aligns them
>>>>> first.
>>>>
>>>> Yes, that was the point that I was trying to make. Well,
>>>arguably it doesn't
>>>> "fail", it just does what it is supposed to do. Things would
>>>"work" with [[
>>>> or a preceding unclass(z), but that would break comparisons
>>>involving, say,
>>>> POSIXlt objects. So you're sort of stuck between a rock and
>>>a hard place.
>>>>
>>>>>
>>>>> On Wed, Oct 22, 2008 at 2:19 PM, Gabor Grothendieck
>>>>> <[hidden email]> wrote:
>>>>>>
>>>>>> Yes, I noticed that but rank is not generic.  An xtfrm.zoo
>>>>>> method has been added to zoo on R-Forge but rank still
>>>>>> fails:
>>>>>>
>>>>>>> R.version.string
>>>>>>
>>>>>> [1] "R version 2.8.0 Patched (2008-10-21 r46766)"
>>>>>>>
>>>>>>> packageDescription("zoo")$Version
>>>>>>
>>>>>> [1] "1.5-3"
>>>>>>>
>>>>>>> library(zoo)
>>>>>>> # next line adds xtfrm zoo method
>>>>>>> xtfrm.zoo <- coredata
>>>>>>> z <- zoo(1:4)
>>>>>>> order(z) # ok
>>>>>>
>>>>>> [1] 1 2 3 4
>>>>>>>
>>>>>>> qqnorm(z) # ok
>>>>>>> rank(z) # error
>>>>>>
>>>>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>>>>  argument is of length zero
>>>>>>
>>>>>>
>>>>>>>>> (If the MIME type is wrong, then that will happen.)
>>>>>>>>>
>>>>>>>>> Anyways, the root cause seems to be the new function
>>>.gt() which is
>>>>>>>>> related to
>>>>>>>>>
>>>>>>>>>   o   New generic function xtfrm() as an auxiliary helper for
>>>>>>>>>       sort(), order() and rank().  This should return a numeric
>>>>>>>>>       vector that sorts in the same way as its input.
>>>The default
>>>>>>>>>       method supports any class with ==, > and is.na()
>>>methods but
>>>>>>>>>       specific methods can be much faster.
>>>>>>>>>
>>>>>>>>>       As a side-effect, rank() will now work better on classed
>>>>>>>>>       objects, although possibly rather slowly.
>>>>>>>>>
>>>>>>>>> Here, "better" may be in the eyes of the beholder, for
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> dax[3]==dax[6]
>>>>>>>>>>
>>>>>>>>> Data:
>>>>>>>>> logical(0)
>>>>>>>>>
>>>>>>>>> Index:
>>>>>>>>> integer(0)
>>>>>>>>>
>>>>>>>>> and accordingly
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> rank(dax)
>>>>>>>>>>
>>>>>>>>> Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
>>>>>>>>>  argument is of length zero
>>>>>>>>>
>>>>>>>>> which is the error that you are seeing.
>>>>>>>>>
>>>>>>>>> What to do about it is a bit dubious. Obviously, we
>>>don't want to
>>>>>>>>> "fix"
>>>>>>>>> .gt() so that it automatically unclasses objects, and I
>>>assume that
>>>>>>>>> zoo
>>>>>>>>> has its reasons for not wanting to compare series with different
>>>>>>>>> indices. So I suppose that either the user must
>>>unclass, or zoo define
>>>>>>>>> rank.zoo.
>>>>>>>>>
>>>>>>>> Actually qqnorm does not use rank but it does use order
>>>and with the
>>>>>>>> xtfrm.zoo method I mentioned qqnorm works with zoo;
>>>however, I think
>>>>>>>> rank needs to be fixed in R to make use of xtfrm as well
>>>since I would
>>>>>>>> have
>>>>>>>> expected that supplying an xtfrm method for zoo would be
>>>sufficient to
>>>>>>>> get both order and rank to work without giving errors.
>>>Also note that
>>>>>>>> rank
>>>>>>>> is not generic.
>>>>>>>>
>>>>>>> Notice that xtfrm.default() uses rank()....
>>>>>>>
>>>>>>> --
>>>>>>>  O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>>>>>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>>>>>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:
>>>(+45) 35327918
>>>>>>> ~~~~~~~~~~ - ([hidden email])              FAX:
>>>(+45) 35327907
>>>>>>>
>>>>>>>
>>>>>>>
>>>>
>>>>
>>>> --
>>>>   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>>>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>>>  (*) \(*) -- University of Copenhagen   Denmark      Ph:
>>>(+45) 35327918
>>>> ~~~~~~~~~~ - ([hidden email])              FAX:
>>>(+45) 35327907
>>>>
>>>
>> *****************************************************************
>> Confidentiality Note: The information contained in this message,
>> and any attachments, may contain confidential and/or privileged
>> material. It is intended solely for the person(s) or entity to
>> which it is addressed. Any review, retransmission, dissemination,
>> or taking of any action in reliance upon this information by
>> persons or entities other than the intended recipient(s) is
>> prohibited. If you received this in error, please contact the
>> sender and delete the material from any computer.
>> *****************************************************************
>>
>>
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel