Skip to content
Prev 4821 / 398506 Next

infinite recursion problem

Thomas Lumley wrote :
Thanks for your reply and sorry for my uncomplete posting of yesterday (it
was late...). Original posting is enclosed below.
any hints would be very appreciated.

here are HTMLExport (generic function) and HTMLExport.lm :

"HTMLExport"<-
function(x, ...)
{
 UseMethod("HTMLExport")
}

"HTMLExport.lm"<-
function(lmobject, File = "", Directory = "./", Desc = F, ...)
{
 options(warn = -1)
 GraphDirectory <- Directory
 NameReg <- deparse(substitute(lmobject))
 if(File == "") {
  File <- paste(Directory, "Result.of.regression.", NameReg,
   ".html", sep = "")
 }
 txt <- lmobject$model
 # txt <- substring(txt, regexpr("data=*", txt) + 5, nchar(txt) - 1)
 donnees<-txt
 eval(parse(text = "attach(donnees, pos=2)"))
 # File <- HTMLInitFile(File)
 vardep <- as.character(attr(lmobject$terms, "variables"))[-1]
 variables <- attr(lmobject$terms, "term.labels") #
 HTMLTitle("&nbsp;<B>Results of regression</B>", Size = "+3", BackColor
   = "000000", Color = "FFFFFF", File = File) #
#
# GENERATION DE L'INDEX
 ...<deleted>...
 if(Desc == T) {
  HTMLExport(as.title("Descriptive informations"), File = File)
  HTML.LI(paste("Data for regression: ",deparse(substitute(lmobject)), sep =
""), File =
   File)
  HTML.LI(paste("Dimensions of the data: ", dim(donnees)[1],
   " X ", dim(donnees)[2], sep = ""), File = File)
  HTML.LI(paste("Dependant variable: ", vardep, sep = ""), File
    = File)
  HTML.LI("List of variables: ", File = File)
  cat(variables, sep = "&nbsp; | &nbsp;", append = T, file = File
   )
  HTML.BR(File = File)
  HTML.LI("<B><A NAME=#desc-correlations>Correlation matrix</A></B>: ",
   File = File)
  data <- donnees[, c(vardep, variables)]
  HTMLExport(round(cor(data), 4), FirstColumnBold = T,
   FirstRowBold = T, File = File)
  desc <- t(t(summary(data[, vardep])))
  if(dim(desc)[1] == 6) {
   desc <- rbind(desc, 0)
  }
  for(var in variables) {
   desc2 <- t(t(summary(data[, var])))
   if(dim(desc2)[1] == 6) {
    desc2 <- rbind(desc2, 0)
   }
   desc <- cbind(desc, desc2)
  }
  dimnames(desc) <- list(c("Min.", "1st Qu.", "Median", "Mean",
   "3rd Qu.", "Max.", "NA"), c(vardep, variables))
  HTML.LI("<A NAME=#desc_stats><B>Descriptive statistics</B></A>: ",
   File = File)
  HTMLExport(round(desc, 4), FirstColumnBold = T, File = File)
  HTML.LI("<A NAME=#desc_boxplots><B>Boxplots:</B></A>", File =
   File)
  AllVar <- c(vardep, variables)
  k <- trunc((length(AllVar) - 1)/4)
  par(mfrow = c(1, 4))
  for(i in 0:k) {
   subvar <- AllVar[(4 * i + 1):(4 * i + 4)]
 #  print(subvar)
   for(var in subvar) {
    if(var != "") {
      boxplot(data[, var], outchar = T, main = var)
    }
   }
   HTMLInsertGraph(File = File, GraphDirectory =
    GraphDirectory, GraphFileName = paste("boxplot",
    i + 1, ".", NameReg, sep = ""))
  }
 }
 HTMLTitle(as.title("Summary"), File = File)
 HTMLExport(summary(lmobject), File = File)
 HTMLTitle(as.title("Graphs"), File = File)
 HTMLPlot.lm(lmobject, GraphDirectory = GraphDirectory, Name = NameReg,
  File = File)
 HTMLEndFile(File)
 detach(what = 2)
 options(warn = 1)
}
--
----------------------------------------------------------------------
Mathieu Ros - 13 rue b?vi?re - 38000 GRENOBLE - 04 76 491 370
http://mathieu.ros.free.fr/
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._