[R] pull stat out of summary

Bert Gunter bgunter.4567 at gmail.com
Sat Apr 1 02:14:33 CEST 2017


tells you the structure of any object. *Learn to use it!*

It may well be the that you *cannot* do what you describe. As you
should know by now in your "learning curve", invoking

> obj

at the console silently invokes the print method for obj, and what is
printed may in fact be calculated on the fly in the print method and
not stored in an object anywhere.


is such an example:  p-values are calculated and printed, but not stored.


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Fri, Mar 31, 2017 at 4:54 PM, Sarah Goslee <sarah.goslee at gmail.com> wrote:
> The short answer is that hold isn't a list-like object, and $ only
> works with list-like objects (lists and data frames, mainly).
> You can get the full explanation (VERY full), at
> ?Extract
> or any of its aliases, like
> ?'$'
> or
> ?'['
> Sarah
> On Fri, Mar 31, 2017 at 7:11 PM, Evan Cooch <evan.cooch at gmail.com> wrote:
>> Continuing my learning curve after 25_ years with using SAS. Want to pull
>> the "Mean" forom the summary of something...
>> test <- rnorm(1000,1.5,1.25)
>> hold <- summary(test)
>> names(hold)
>> [1] "Min."    "1st Qu." "Median"  "Mean"    "3rd Qu." "Max."
>> OK, so "Mean" is in there.
>> So, is there a short form answer for why hold$Mean throws an error, and
>> hold["Mean"} returns the mean (as desired)?
>> Silly question I know,  but gotta start somewhere...
>> Thanks...
> --
> Sarah Goslee
> http://www.functionaldiversity.org
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

More information about the R-help mailing list