How can you easily change the column width in an htmltable in R. I am using the htmltable package.
Any help would be appreciated
htmlTable(DataFrame, align = "c",
rnames = FALSE,
caption = "<b> <center> <font face = Times New Roman> Table 1. Population By Territory <br> <br>",
tfoot = "<b> Source </b> <br> [1] Random Data Source",
header = paste(c(" Territory", "Number of People")),
css.caption = "color:red;",
col.rgroup = c("none", "#ADADAD"),
padding.tspanner = "", ctable = TRUE,
css.cell = "<td width = 110px>",
)
The bug in the code is primarily the css.cell
argument, this is html code and not cascade-style as expected. What you probably wanted to do was:
htmlTable(DataFrame, align = "c",
rnames = FALSE,
caption = "<b> <center> <font face = Times New Roman> Table 1. Population By Territory <br> <br>",
tfoot = "<b> Source </b> <br> [1] Random Data Source",
header = paste(c(" Territory", "Number of People")),
css.caption = "color:red;",
col.rgroup = c("none", "#ADADAD"),
padding.tspanner = "", ctable = TRUE,
css.cell = "width: 110px", # <-- drop the "td" stuff, this all goes into the style="" for the element
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.