Re: [R] attr question

From: Duncan Murdoch <murdoch.duncan_at_gmail.com>
Date: Mon, 07 Mar 2011 09:00:39 -0500

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



R-help_at_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. Received on Mon 07 Mar 2011 - 14:06:06 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 07 Mar 2011 - 14:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive