[R] How to make sub-headers in R

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Fri May 15 16:42:52 CEST 2015

I think you are not interpreting what is happening correctly. Column names are labels used for purposes of referring to the data in your R code. That they might also be useful in presenting data in output is coincidental. The fact that many data input functions replace spaces in those labels with periods should convince you of this fact.

On the other hand, the options available when you output that table usually depend on where you want to display the result, which you have not mentioned. For example the tables package has many options for labeling columns if you are generating HTML or LaTeX output. Or, you could write your own function to generate any output format you want.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

On May 15, 2015 6:55:17 AM PDT, "Liao, Hongsheng" <HLiao at odu.edu> wrote:
>I know how to make one-row header for a data frame using "colnames". 
>Is there any function to insert sub-header between the first row of the
>data and the header?  Thanks
>Hongsheng (Hank) Liao, PhD.
>Lab Manager
>Center for Quantitative  Fisheries Ecology
>Old Dominion University
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list