[R] Generating tables

Benjamin Dickgiesser dickgiesser at gmail.com
Thu Oct 26 19:57:07 CEST 2006


I am actually trying to write something above the first column ( in
the example the column with numbers 1 to 8) is this possible at all?
If not, is there another way to make a table which supports this? I am
merely using a data frame as a way to create a table I don't need the
data to be this data type.

Benjamin

On 10/26/06, Leeds, Mark (IED) <Mark.Leeds at morganstanley.com> wrote:
> I think colnames(DF)<-c("meanname","sdname","nname") should work if
> that's what you want.
>
>
>
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Benjamin
> Dickgiesser
> Sent: Thursday, October 26, 2006 1:08 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Header of dataframe
>
> Hi
> I am fairly new to R and I would appreciate some help to hopefully a
> trivial problem.
>
> I created a function:
>
> summary.aggregate <- function(y, ...)
> {
>         temp.mean       <- aggregate(y, FUN=mean, ...)
>         temp.sd                 <- aggregate(y, FUN=sd, ...)
>         temp.length <- aggregate(y, FUN=length, ...)
>         temp <-
> data.frame(cbind(mean=temp.mean$x,stdev=temp.sd$x,n=temp.length$x))
> }
>
> this outputs e.g.:
>
>       mean    stdev  n
> 1 645.6125 65.94129 60
> 2 655.2121 70.64094 60
> 3 633.3161 80.48620 60
> 4 650.3897 77.59191 60
> 5 630.4955 84.98888 60
> 6 656.2608 66.16100 60
> 7 666.1775 74.39796 60
> 8 663.1543 71.10769 60
>
> Is there an easy way to add a column name to the first column?
>
> Thank you,
> Benjamin
>



More information about the R-help mailing list