Skip to content

odd behavior within R2HTML

2 messages · Erin Hodgess, Milan Bouchet-Valat

#
Dear R People:

I'm using R2HTML but having a strange result.

Here is the original data:

resp trt block
90.3 A I
89.2 A II
98.2 A III
93.9 A IV
87.4 A V
97.9 A VI
92.5 B I
89.5 B II
90.6 B III
94.7 B IV
87.0 B V
95.8 B VI
85.5 C I
90.8 C II
89.6 C III
86.2 C IV
88.0 C V
93.4 C VI
82.5 D I
89.5 D II
85.6 D III
87.4 D IV
78.9 D V
90.7 D VI

And here are the commands:
+ )
*** Output redirected to directory:  c:/R64/R-2.15.2/bin/x64
 *** Use HTMLStop() to end redirection.[1] TRUE
HTML> library(effects)
Loading required package: lattice
Loading required package: grid
Loading required package: MASS
Loading required package: nnet
Loading required package: colorspace

Attaching package: ?effects?

The following object(s) are masked from ?package:datasets?:

    Titanic

HTML> summary(allEffects(resin1.aov)
+ )
 model: resp ~ trt + block

 trt effect
trt
       A        B        C        D
92.81667 91.68333 88.91667 85.76667

 Lower 95 Percent Confidence Limits
trt
       A        B        C        D
90.46148 89.32815 86.56148 83.41148

 Upper 95 Percent Confidence Limits
trt
       A        B        C        D
95.17185 94.03852 91.27185 88.12185

 block effect
block
     I     II    III     IV      V     VI
87.700 89.750 91.000 90.550 85.325 94.450

 Lower 95 Percent Confidence Limits
block
      I      II     III      IV       V      VI
84.8155 86.8655 88.1155 87.6655 82.4405 91.5655

 Upper 95 Percent Confidence Limits
block
      I      II     III      IV       V      VI
90.5845 92.6345 93.8845 93.4345 88.2095 97.3345
HTML> HTMLStop()
[1] "c:/R64/R-2.15.2/bin/x64/resin2_main.html"
When I look in the resin2_main.html file, the results from the summary
are not there.

Has anyone run into this before, please?

Thanks for any help!

Sincerely,
Erin
R-2.15.2, Windows, 64-bit
#
Le vendredi 15 f?vrier 2013 ? 20:52 -0600, Erin Hodgess a ?crit :
Yes, this is fully reproducible with examples from ?allEffects. The
problem is that summary.efflist() does not return an object that R2HTML
could print(). Instead, it calls print() directly on all of the separate
effects in the list, and returns invisible(NULL).

You can fix this by making summary.efflist() return an object containing
the needed data, and creating a function to print this object as below.
Maybe John Fox will want to apply this kind of change to the package.


Regards

summary.efflist <- function (object, ...) 
{
    form <- object[[1]]$formula
    attributes(form) <- NULL
    ret <- list(formula=form,
                eff=lapply(object, summary, ...))

    class(ret) <- "summary.efflist"
    ret
}

print.summary.efflist <- function(x, ...)
{
    cat(" model: ")
    print(x$formula)

    for (effect in names(x$eff)) {
        print(x$eff[[effect]], ...)
    }

    invisible(x)
}