Have you tried xtable?
library( xtable )
x <- structure(list(Record = 1:3, Average = c(34L, 14L, 433L), Maximum =
c(899L,
15L, 1003L)), .Names = c("Record", "Average", "Maximum"), class = "data.frame",
row.names = c(NA,
-3L))
x <- xtable( x )
print( x )
% latex table generated in R 2.15.2 by xtable 1.7-1 package
% Fri May 17 22:22:00 2013
\begin{table}[ht]
\centering
\begin{tabular}{rrrr}
\hline
& Record & Average & Maximum \\
\hline
1 & 1 & 34 & 899 \\
2 & 2 & 14 & 15 \\
3 & 3 & 433 & 1003 \\
\hline
\end{tabular}
\end{table} On Friday 17 May 2013 12:53:12 Patrick Leyshock wrote: > Is there any way to format the headers of data frames, for printing? > > I am using Sweave to generate formatted reports. In Sweave, I read in a > data.frame: > > result <- read.table(path.to.table); > > then display it: > > print.data.frame(result); > > This gives me what I expect in the eventual final output: > > Record Average Maximum > 1 34 899 > 2 14 15 > 3 433 1003 > ... ... ... > > What I am hoping to do is distinguish one or more of the column headers, > for example, I want "Average" or "Maximum" to be bold, underlined, etc., > just some way to make the column name stand out visually. > > Any idea if this is possible? Any suggestions appreciated. > > [[alternative HTML version deleted]] > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

