[R] improve formatting of HTML table

Juliet Hannah juliet.hannah at gmail.com
Thu Aug 11 18:04:14 CEST 2011


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.

Thanks.

> sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] R2HTML_2.2



More information about the R-help mailing list