[R] output without labels and delimited by Tab

ben@zoo.ufl.edu ben at zoo.ufl.edu
Mon Feb 26 22:09:51 CET 2001


  The main function driving the formatting here is summary.data.frame().
You can hack this function to get the formatting you want.

  Or (for a probably-quicker but less general solution) you can just write
your own function with less complication than summary.data.frame.

mysum <- function(x) {
  qq <- quantile(x,c(0.25,0.5,0.75))
  c(min(x),qq[1:2],mean(x),qq[3],max(x))
}

write.table(apply(x,2,mysum),sep="\t",quote=FALSE,row.names=FALSE)

Does more or less what you want, although there is a problem with the
column headers being shorter (and thus not tabbed over as far) as the
columns.  You could implement something with blank-padding, keeping the
same number of significant digits for all the numbers, etc., but
eventually you will find yourself rewriting summary.data.frame() from
scratch.

On Mon, 26 Feb 2001, Yu-Ling Wu wrote:

> Hi,
>
> I have a set of data and when I run "summary(data)", I
> got the following output:
>
>     dstuser         dstmethod        numaction
>  Min.   : 0.000   Min.   : 0.000   Min.   :  0.00
>  1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.:  2.00
>  Median : 3.000   Median : 6.500   Median : 33.00
>  Mean   : 4.894   Mean   : 6.565   Mean   : 59.32
>  3rd Qu.: 9.000   3rd Qu.:11.000   3rd Qu.: 94.25
>  Max.   :25.000   Max.   :19.000   Max.   :317.00
>
> Question (1): How to make the output look like this
> (get rid of the "labels")?
>
> dstuser dstmethod  numaction
>  0.000   0.000   0.00
>  1.000   1.000   2.00
>  3.000   6.500   33.00
>  4.894   6.565   59.32
>  9.000   11.000  94.25
>  25.000  19.000  317.00
>
> Question (2): How to make each column delimited by Tab
> instead of white spaces?
>
> Thanks,
> Yu-Ling Wu
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list