If you are happy with the character strings printed out then you can use
the capture.output function.

If you want the numbers (without needing to convert) then look at the print
method for the class of object that you are working with and see what the
code is.  It is probably calling another function to produce the output and
you could just call that function directly.  If not, you can copy that
section of the code into your own function to call and have it return the
object rather than printing.


On Wed, Jul 17, 2013 at 3:38 PM, Gang Chen <gangchen6@gmail.com> wrote:

> 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
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Gregory (Greg) L. Snow Ph.D.
538280@gmail.com

	[[alternative HTML version deleted]]

