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
Please report to the package maintainer. Uwe Ligges On 11.08.2011 18:04, 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. > > 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 > > ______________________________________________ > R-help at 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.
On Thu, Aug 11, 2011 at 5:04 PM, Juliet Hannah <juliet.hannah at gmail.com> wrote:> I am trying to improve the look of an HTML table for a report (that > needs to be pasted into Word).> 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.Its not really the HTML's job to look nice, HTML is (supposed to be) purely semantic. Here is a table, here is a row, here is a cell with some stuff in it. To make a web page look nice you write an accompanying CSS file that styles the HTML - blue background, purple text and so on. But you want to paste into Word. I pasted it into OpenOffice (not got Word) and could easily style it from there - highlight the column, set left-justification and so on. Word should be similar. If you love Word for its wysiwyg behaviour, I suggest you do that. Barry
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