[R] attr question

Duncan Murdoch murdoch.duncan at gmail.com
Mon Mar 7 15:00:39 CET 2011


On 07/03/2011 12:11 AM, Erin Hodgess wrote:
> Dear R People:
>
> When I want to produce a small sample confidence interval using
> t.test, I get the following:
>
> >  t.test(buzz$var1, conf.level=.98)$conf.int
> [1] 2.239337 4.260663
> attr(,"conf.level")
> [1] 0.98
>
> How do I keep the attr statement from printing, please?  I'm sure it's
> something really simple.

The as.numeric() function strips attributes, so

as.numeric(t.test(buzz$var1, conf.level=.98)$conf.int)

should work.

Duncan Murdoch



More information about the R-help mailing list