[R] infinite recursion problem

Thomas Lumley thomas at biostat.washington.edu
Wed Mar 8 23:49:48 CET 2000


On Wed, 8 Mar 2000, Mathieu Ros wrote:

> hello r-users,
> sorry for asking a long question that may not be very relevant for the
> list but it's upsetting me and I get no other solution...

We need the example to tell what's wrong -- ie we need HTMLExport as well
as HTMLExport.list.

Based on just this function I can't see why there is a problem or why the
change that you say helps in S-PLUS would do anything.

The question about S-PLUS would be more appropriate for the s-news mailing
list, but if the function called by .C was undocumented in Splus4 it's
quite possible that it doesn't exist in Splus5.


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle


> 
> I get a function HTMLExport.lm that uses another function called
> HTMLExport.list.
> My problem is that function HTMLExport.list works fine when used alone
> but HTMLExport.lm crashes with the following error :
> 
> > HTMLExport(iris.lm)
> lm(formula = Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width)
> Error in names.default(x) : evaluation is nested too deeply: infinite
> recursion?
> 
> Here is the code of HTMLExport.list :
> "HTMLExport.list"<-
> function(x, prefix = "", File = "", Align = "left", ...)
> {
>  xlen <- length(x)
>  if(xlen == 0) {
>   cat("list()\n")
>   return(invisible(x))
>  }
>  n <- names(x)
>  if(is.null(n))
>   this <- paste(prefix, "[[", 1:xlen, "]]", sep = "")
>  else this <- paste(prefix, "$",names(x), sep = "")
>  for(i in 1:xlen) {
>   this[i] <- substring(this[i], 2, nchar(this[i]))
>   cat(paste("<P ALIGN=", Align,
>    "><TABLE BORDER=0><TD BGCOLOR=E4E4E4><FONT FACE=ARIAL><B>",
>    this[i], "</TD></TABLE></P>", sep = ""), file = File,
>    append = T, sep = "")
>   HTMLExport(x[[i]], File = File, prefix = this[i], ...)#here is the
> problem according to debug()
>  }
>  invisible(x)
> }
> 
> 
> In Splus4 version of these function, the problem had been fixed using
> this <- paste(prefix, "$", .C("names_unlex",n,as.integer(xlen))[[1]],
> sep = "")
> instead of
> this <- paste(prefix, "$",names(x), sep = "")
> but it can't work within R...
> 
> Could someone explain me what happens (even if I have a vague idea)
> and/or give me a tip to handle this problem.
> 
> Also, I get Splus5.1 (linux mandrake7.0) and can't find a way to use
> .C("names_unlex",...), could someone explain me what it does and where
> to find the code (if it's not a Splus4 feature?).
> 
> thanks a lot,
>     Mathieu

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list