[R] How to capture the printout on the screen?

Gang Chen gangchen6 at gmail.com
Wed Jul 17 23:38:39 CEST 2013


This is most likely a silly question.

First I run the following:

require(car)
mod.ok <- lm(cbind(pre.1, pre.2, pre.3, pre.4, pre.5, post.1, post.2,
post.3, post.4, post.5,
                          fup.1, fup.2, fup.3, fup.4, fup.5) ~
treatment*gender, data=OBrienKaiser)
phase <- factor(rep(c("pretest", "posttest", "followup"), c(5, 5, 5)),
levels=c("pretest", "posttest", "followup"))
hour <- ordered(rep(1:5, 3))
idata <- data.frame(phase, hour)
(fm <- linearHypothesis(mod.ok, c("treatment1", "treatment2"),
idata=idata, idesign=~phase*hour, iterms="phase:hour"))

I get the output like the following (only the last part at the end is
shown below):

...
Multivariate Tests:
                 Df test stat  approx F num Df den Df  Pr(>F)
Pillai            2 0.6623840 0.2475987     16      8 0.99155
Wilks             2 0.4460357 0.1864957     16      6 0.99668
Hotelling-Lawley  2 0.9988990 0.1248624     16      4 0.99904
Roy               2 0.5792977 0.2896488      8      4 0.93605

I want to capture the data frame shown above, but it's not part of 'fm':

str(fm)

I guess the print method for an object of class "Anova.mlm"
("print.Anova.mlm") generates the above data frame. My question is:
How to capture it? I mean, how can I store the output on the screen
and then extract the data frame?

Thanks,
Gang



More information about the R-help mailing list