[R] t.test & formatting question

Chuck Cleland ccleland at optonline.net
Sat Apr 17 01:21:11 CEST 2004


   How about this?

t.test(x)[[1]]

   The result of t.test(x) is a list and "statistic" is the first 
component of that list.

christopher ciotti wrote:
> ...
> I'm trying to format some data where I only need one of the values 
> returned from a test, say a t-test in this instance.  I have the following:
> 
>  > R.version.string
> [1] "R version 1.9.0, 2004-04-12"
>  > x <- rnorm(1001)
>  > t.test(x)$statistic
>        t
> 0.5555321
>  >
> 
> Any easy way (other than straight calculation) to get the t-statistic 
> w/o the 't' above it?  TIA
> ... 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list