Re: [R] extracting the t-statistic: just the numbers, please

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Thu 29 Jul 2004 - 16:31:16 EST

Michael Rennie <mrennie@utm.utoronto.ca> writes:

> > simt
> t t t t t t t
> 0.3474150 0.1542973 -0.4044992 1.2466663 -0.2933944 -0.5809257 0.7799080
> t t t
> -1.4132713 1.2048335 -0.6596936
>
> Which gives me a list, but not in a form that I can do anything with. This is
> in stark contrast to what happens when requesting p-values, which gives output
> like this:

..

> > simt
> [1] 0.6763749 0.7480091 0.9447851 0.3342029 0.7852635 0.3199006 0.5272153
> [8] 0.3863616 0.7333693 0.7268907
>
> Now THAT'S what I'd like to get for my t-statistics- a nice vector (simt) that
> I can deal with later, rather than the output I am currently getting (the first
> output above).
>
> Does anyone know a way to extract JUST the t-statistics from the t.test,
> without the "t" character header, so I can generate a nice little vector?
> Alternatively, can I manipulate the output I am currently getting for the t-
> statistics so that I can isolate just the numbers?

It *is* a nice little vector! It's just that it has names.

names(simt) <- NULL

gets rid of them.

BTW, simt <- c(simt, sims) is going to kill performance with large repeat counts since it copies all previous results every time around. Preallocate the result, or consider using replicate() or sapply().

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Jul 29 16:48:58 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:55:20 EST