From lwollman at symmetricom.com  Fri Apr 30 18:46:59 2010
From: lwollman at symmetricom.com (Lester Wollman)
Date: Fri, 30 Apr 2010 09:46:59 -0700
Subject: [Rd] Possible bug in POSIX classes for R 2.11.0?
Message-ID: <EA27D7728FE1E84BB71A329047339137045E39E8@sjmail2.symmetricom.com>

To the R development team;

I found an unusual behavior in zoo when I upgraded to R 2.11.0 - it abruptly terminated when I performed certain operations on large zoo objects.  I sent an e-mail to Achim Zeileis and he said this was a potential bug that I should report to the R development team.  The details are given below in the thread below.  Basically, I can crash R with this code:

library(zoo)
x <- runif(140000, 2009, 2010)
x <- as.yearmon(x)
table(x)

This will not crash with a vector of size 130000.

Achim got it to crash with the following code that did not use zoo:

x <- rep(as.Date("1970-01-01"), 140000)
y <- as.POSIXlt(x)
z <- format(y, "%d")

I did find a work around, so this is no longer an immediate problem for me, but it would be better if the problem didn't exist in the first place.  Thank you for your help.

Lester Wollman
Corporate Statistician
Symmetricom, Inc.
Lwollman at symmetricom.com



-----Original Message-----
From: Achim Zeileis [mailto:Achim.Zeileis at uibk.ac.at] 
Sent: Thursday, April 29, 2010 1:16 PM
To: Lester Wollman
Subject: Re: Unusual behavior of zoo and R2.11.0 - simple operation on large zoo object crashes R

Lester,

thanks for the report. The problem does not seem to be in "zoo" but in the 
new POSIX classes and/or their their coercion from "Date".

The following should reproduce your crash:

x <- rep(as.Date("1970-01-01"), 140000)
y <- as.POSIXlt(x)
z <- format(y, "%d")

The reason is probably that R-core changed the internals of all the POSIX 
stuff. Furthermore, this problem appears to be fixed in 2.12.0 (the 
current devel version). Maybe you can ask on R-devel whether this is a 
know issue (my guess is that it is).

Thanks for the report && best wishes,
Z

On Thu, 29 Apr 2010, Lester Wollman wrote:

> 
> Achim,
> 
> ?
> 
> I found unusual behavior, or even possibly a bug, ?in zoo.? When I run the
> code below, R crashes.? There is no error message,? R simply exits with no
> warning.
> 
> ?
> 
> ?
> 
> library(zoo)
> 
> x <- runif(140000, 2009, 2010)? ???# Random days in 2009
> 
> x <- as.yearmon(x)?????????????? ??# This works
> 
> table(x)???????????????????????? ??# ?This crashes.?print(x) also crashes R. summary(x) does not
> 
> 
> ?
> 
> ?
> 
> However, if I change the number of random dates to 130000, there is no
> problem.
> 
> ?
> 
> I have been using zoo for a few years with no problems, ?including using
> code similar to the one above.? I did just upgrade to R 2.11.0 and this is
> my first use of zoo for a large vector since the upgrade.
> 
> ?
> 
> I cannot tell if the problem is with zoo or R or my machine.? I tried
> installing zoo from CRAN instead of R-Forge, but that did not help.?
> Increasing the memory limit to 3G did not help either.
> 
> ?
> 
> I attached relevant (and irrelevant) system information below.? I am using R
> with Tinn-R and Tinn-R loads some packages (Hmisc, R2HTML, etc.)
> 
> ?
> 
> Thank you for your help.
> 
> ?
> 
> ?
> 
> Lester Wollman
> 
> Corporate Statistician
> 
> Symmetricom, Inc.
> 
> lwollman at symmetricom.com
> 
> ?
> 
> ?
> 
> ?
> 
> ?
> 
> > sessionInfo()
> 
> ?
> 
> R version 2.11.0 (2010-04-22)
> 
> i386-pc-mingw32
> 
> ?
> 
> locale:
> 
> [1] LC_COLLATE=English_United States.1252? LC_CTYPE=English_United
> States.1252??? LC_MONETARY=English_United States.1252
> 
> [4] LC_NUMERIC=C?????????????????????????? LC_TIME=English_United
> States.1252???
> 
> ?
> 
> attached base packages:
> 
> [1] grDevices datasets? splines?? graphics? stats???? tcltk???? utils????
> methods?? base????
> 
> ?
> 
> other attached packages:
> 
> [1] svSocket_0.9-48 TinnR_1.0.3???? R2HTML_2.0.0??? Hmisc_3.7-0????
> survival_2.35-8
> 
> ?
> 
> loaded via a namespace (and not attached):
> 
> [1] cluster_1.12.3 grid_2.11.0??? lattice_0.18-5 svMisc_0.9-57
> 
> ?
> 
> ?
> 
> System Information:
> 
> Windows XP Professional Version 2002 Service Pack 3
> 
> ?
> 
> Computer Information:
> 
> Dell with Intel CPU
> 
> T2600 @ 2.16 GHz, 1G of RAM
> 
> ?
> 
> ?
> 
> ?
> 
> zoo information
> 
> > packageDescription("zoo")
> 
> Package: zoo
> 
> Version: 1.6-3
> 
> Date: 2010-02-22
> 
> Title: Z's ordered observations
> 
> Author: Achim Zeileis, Gabor Grothendieck, Felix Andrews
> 
> Maintainer: Achim Zeileis <Achim.Zeileis at R-project.org>
> 
> 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 ts and base R by
> providing methods to extend standard generics.
> 
> Depends: R (>= 2.10.0), stats
> 
> Suggests: coda, chron, DAAG, fCalendar, fSeries, fts, its, lattice,
> strucchange, timeDate, timeSeries, tis, tseries, xts
> 
> Imports: stats, utils, graphics, grDevices, lattice (>= 0.18-1)
> 
> LazyLoad: yes
> 
> License: GPL-2
> 
> URL: http://R-Forge.R-project.org/projects/zoo/
> 
> Repository: R-Forge
> 
> Repository/R-Forge/Project: zoo
> 
> Repository/R-Forge/Revision: 688
> 
> Date/Publication: 2010-03-20 02:29:04
> 
> Packaged: 2010-03-20 21:59:26 UTC; rforge
> 
> Built: R 2.11.0; ; 2010-03-22 14:03:33 UTC; windows
> 
> ?
> 
> -- File: C:/PROGRA~1/STATIS~1/R2110/library/zoo/Meta/package.rds
> 
> 
>



[Rd] Possible bug in POSIX classes for R 2.11.0?
Lester Wollman