[R] infinite recursion problem

Mathieu Ros mathieuros at bigfoot.com
Wed Mar 8 22:52:46 CET 2000

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...

I get a function HTMLExport.lm that uses another function called
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

Here is the code of HTMLExport.list :
function(x, prefix = "", File = "", Align = "left", ...)
 xlen <- length(x)
 if(xlen == 0) {
 n <- names(x)
  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,
   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()

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 Ros
DESS ingénierie mathématique (biostatistiques)
Universite Joseph Fourier, Grenoble
l'expérience est le nom que chacun donne a ses erreurs. Wilde

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