[R] Problem with all.equal and POSIXt.

Joshua Wiley jwiley.psych at gmail.com
Mon Sep 13 04:32:34 CEST 2010


I get the same error.  On debugging, after the 10th iteration (~1,375
lines after the all.equal(x, x) call), I get:

exiting from: all.equal(target[[i]], current[[i]], check.attributes =
check.attributes,
    ...)
debugging in: all.equal(target[[i]], current[[i]], check.attributes =
check.attributes,
    ...)
debug: UseMethod("all.equal")
Browse[4]> ls() # so it shows "current" and "target", but...
[1] "current" "target"
Browse[4]> current # when I try to look at it
Error in current[[i]] : subscript out of bounds
Browse[4]> target
Error in target[[i]] : subscript out of bounds
Browse[4]> getAnywhere(current)
no object named 'current' was found
Browse[4]> environment()
<environment: 0x0000000006037088>
Browse[4]> exists(current)
Error in current[[i]] : subscript out of bounds
In addition: Warning message:
In exists(current) : restarting interrupted promise evaluation

Which is utterly out of my league, but perhaps useful to others.  At
the least, this seems an odd error message to give if all.equal()
cannot handle that type of object.

My system:
R version 2.11.1 (2010-05-31)
x86_64-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] grid_2.11.1  tools_2.11.1


Josh

On Sun, Sep 12, 2010 at 6:28 PM, Rolf Turner <r.turner at auckland.ac.nz> wrote:
>
> I'm getting an error when applying all.equal() to objects of
> class POSIXt.
>
> E.g.
>
> x <- strptime(rep("2007-02-12",10),format="%Y-%m-%d")
> all.equal(x,x)
> Error in target[[i]] : subscript out of bounds
>
> The object seems to have to be of double-digit length to trigger the
> error.  E.g.
>
> all.equal(x[1:9],x[1:9])
>
> returns TRUE.
>
> I did a cursory search of the r-help pages and found no reference to this
> problem.
>
> Is this a bug, or am I missing something?
>
>        cheers,
>
>                Rolf Turner
>
> P. S.: > sessionInfo()
> R version 2.11.1 (2010-05-31)
> x86_64-apple-darwin9.8.0
>
> locale:
> [1] en_NZ.UTF-8/en_NZ.UTF-8/C/C/en_NZ.UTF-8/en_NZ.UTF-8
>
> attached base packages:
> [1] datasets  utils     stats     graphics  grDevices methods   base
>
> other attached packages:
> [1] misc_0.0-12    fortunes_1.3-7 MASS_7.3-6
>
> loaded via a namespace (and not attached):
> [1] tools_2.11.1
>
>
> ######################################################################
> Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list