On 08/12/2011 02:04 AM, Juliet Hannah wrote:
I am trying to improve the look of an HTML table for a report (that
needs to be pasted into Word).
Here is an example.
table2<- structure(c(26L, 0L, 40L, 0L, 10L, 0L, 0L, 188L, 0L, 281L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 4L), .Dim = c(6L, 3L), .Dimnames = structure(list(
myvar = c("Don't know", "Somewhat likely", "Somewhat unlikely",
"Very likely", "Very unlikely", NA), var_recode = c("0", "1",
NA)), .Names = c("myvar", "var_recode")), class = "table")
library("R2HTML")
.HTML.file = paste(getwd(), "/example.html", sep = "")
HTML(table2)
In the output, I would like to improve the justification of the
numbers (or any other suggestion to make
the HTML look nicer). The columns are a little hard to read.
Hi Juliet,
The example below, when copied from an HTML browser (Konqueror) and
pasted into a word processor (OpenOffice Write) produces a table with no
borders, left justified first column and other columns centered. You can
easily do other justifications if you wish.
library(prettyR)
delim.table(table2,filename="example.html",
tabegin="<table border=0>",bor="<tr><td>",
delim="<td align=center>",html=TRUE)
Jim
______________________________________________
R-help@r-project.org 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.