| 1 |
descr_format_stdstyle <- df_format_stdstyle |
| 2 |
|
| 3 |
format_html.descriptions <- function(x, |
| 4 |
toprule=2,midrule=1,bottomrule=2, |
| 5 |
style=descr_format_stdstyle, |
| 6 |
margin="2ex auto", |
| 7 |
...){ |
| 8 |
|
| 9 |
tab <- cbind( |
| 10 |
html_td(names(x),vectorize=TRUE), |
| 11 |
html_td(x,vectorize=TRUE) |
| 12 |
) |
| 13 |
n <- nrow(tab) |
| 14 |
|
| 15 |
header <- c(html_td("Variable",class="header"), |
| 16 |
html_td("Description",class="header")) |
| 17 |
|
| 18 |
tab <- rbind(header,tab) |
| 19 |
res <- apply(tab,1,html_tr) |
| 20 |
|
| 21 |
res <- html_table(res,class="descriptions") |
| 22 |
|
| 23 |
style_global <- style_df_global(class="descriptions",style=style,margin=margin) |
| 24 |
|
| 25 |
style_toprule <- style_df_rule(class="descriptions",rulewidth=toprule,top=TRUE, |
| 26 |
rows=1) |
| 27 |
style_bottomrule <- style_df_rule(class="descriptions",rulewidth=bottomrule,bottom=TRUE, |
| 28 |
rows=n+1) |
| 29 |
style_midrule <- style_df_rule(class="descriptions",rulewidth=midrule,bottom=TRUE, |
| 30 |
rows=1) |
| 31 |
style_content <- paste( |
| 32 |
style_global, |
| 33 |
style_toprule, |
| 34 |
style_midrule, |
| 35 |
style_bottomrule, |
| 36 |
sep="\n" |
| 37 |
) |
| 38 |
style_element <- html("style",style_content,linebreak=TRUE) |
| 39 |
res <- html_group(style_element,res) |
| 40 |
res <- as.character(res) |
| 41 |
return(res) |
| 42 |
} |