Re: [R] Infinite recursion error that I don't understand

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 3 Jan 2008 18:57:10 +0000 (GMT)

The error is in printing ...

foo <- data.frame(I(z))

works. It is not hard to create a data frame you cannot print, and this is one. It could be considered a bug in format.AsIs, which calls toString without removing its class.

Traceback() helps:

  1. format.AsIs(x, ...)
  2. format(x, ...)
  3. as.character.POSIXt(1199386325.312)
  4. as.character(1199386325.312)
  5. paste(x, collapse = ", ")
  6. toString.default(x[[i]], width = width, ...)
  7. toString(x[[i]], width = width, ...)
  8. format.AsIs(x[[i]], ..., justify = justify)
  9. format(x[[i]], ..., justify = justify)
  10. format.data.frame(x, digits = digits, na.encode = FALSE)
  11. as.matrix(format.data.frame(x, digits = digits, na.encode = FALSE))
  12. print(as.matrix(format.data.frame(x, digits = digits, na.encode = FALSE)), ..., quote = quote, right = right)
  13. print.data.frame(list(z = c(1199386325.312, 1199386325.312, 1199386325.312, 1199386325.312, 1199386325.312)))
  14. print(list(z = c(1199386325.312, 1199386325.312, 1199386325.312, 1199386325.312, 1199386325.312)))

On Thu, 3 Jan 2008, Bert Gunter wrote:

>> sessionInfo()
> R version 2.6.1 Patched (2007-12-03 r43574)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] grDevices datasets stats graphics grid tcltk utils
> [8] methods base
>
> ## ... + other packages..
>
>> z <- rep(Sys.time(),5)
>> data.frame(z)
> z
> 1 2008-01-03 10:19:43
> 2 2008-01-03 10:19:43
> 3 2008-01-03 10:19:43
> 4 2008-01-03 10:19:43
> 5 2008-01-03 10:19:43
>
>> data.frame(I(z))
> Error: evaluation nested too deeply: infinite recursion /
> options(expressions=)?
>
> ## I don't have a clue. Any words of wisdom would be appreciated.
>
> Bert Gunter
> Genentech
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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.
Received on Thu 03 Jan 2008 - 19:01:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jan 2008 - 19:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive