myhtml: Export to html file for class "mytable" or "cbind.mytable" of...

Description Usage Arguments Methods (by class) Examples

View source: R/myhtml.R

Description

Export to html file for class "mytable" or "cbind.mytable" of "data.frame"

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
myhtml(x, caption = NULL, rownames = TRUE)

## Default S3 method:
myhtml(x, caption = NULL, rownames = TRUE)

## S3 method for class 'mytable'
myhtml(x, caption = NULL, rownames = TRUE)

## S3 method for class 'cbind.mytable'
myhtml(x, caption = NULL, rownames = TRUE)

Arguments

x

An object of class "mytable" or "cbind.mytable"

caption

A character

rownames

A logical value whether or not include rownames in table

Methods (by class)

Examples

1
2
3
4
5
6
7
8
9
require(moonBook)
res=mytable(sex~age+Dx,data=acs)
myhtml(res)
res1=mytable(sex+Dx~.,data=acs)
myhtml(res1)
x=head(iris)
myhtml(x)
myhtml(x,caption="Table 1. myhtml Test")
myhtml(x,caption="Table 1. myhtml Test",rownames=FALSE)

Example output

<head><style>
        table, th, td {
        border: 1px solid #bcbcbc;
    } </style></head>
<table cellpadding=10 cellspacing=5><caption>Descriptive Statistics by 'sex'</caption><tr>
<th>sex</th><th>Female<br/>(N=287)</th><th>Male<br/>(N=570)</th><th>p</th></tr>
<tr><td>age                </td><td>68.7 <U+00B1> 10.7</td><td>60.6 <U+00B1> 11.2</td><td>0.000</td></tr>
<tr><td>Dx                 </td><td></td><td></td><td>0.012</td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; NSTEMI         </td><td>50 (17.4%)</td><td>103 (18.1%)</td><td></td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; STEMI          </td><td>84 (29.3%)</td><td>220 (38.6%)</td><td></td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Unstable Angina</td><td>153 (53.3%)</td><td>247 (43.3%)</td><td></td></tr>
</table>
<head><style>
        table, th, td {
        border: 1px solid #bcbcbc;
    } </style></head>
<table cellpadding=5 cellspacing=5>
<caption>Descriptive Statistics stratified by sex and Dx</caption>
<tr>
<th>sex</th><th colspan="4">Male</th><th colspan="4">Female</th></tr>
<tr>
<th>Dx</th><th>NSTEMI<br/>(N=103)</th><th>STEMI<br/>(N=220)</th><th>Unstable Angina<br/>(N=247)</th><th>p</th><th>NSTEMI<br/>(N=50)</th><th>STEMI<br/>(N=84)</th><th>Unstable Angina<br/>(N=153)</th><th>p</th></tr>
<tr><td>age             </td><td>61.1 <U+00B1> 11.6</td><td>59.4 <U+00B1> 11.7</td><td>61.4 <U+00B1> 10.6</td><td>0.133</td><td>70.9 <U+00B1> 11.4</td><td>69.1 <U+00B1> 10.4</td><td>67.7 <U+00B1> 10.7</td><td>0.177</td></tr>
<tr><td>cardiogenicShock</td><td></td><td></td><td></td><td>0.000</td><td></td><td></td><td></td><td>0.000</td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; No          </td><td>100 (97.1%)</td><td>183 (83.2%)</td><td>247 (100.0%)</td><td></td><td>49 (98.0%)</td><td>73 (86.9%)</td><td>153 (100.0%)</td><td></td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Yes         </td><td>3 ( 2.9%)</td><td>37 (16.8%)</td><td>0 ( 0.0%)</td><td></td><td>1 ( 2.0%)</td><td>11 (13.1%)</td><td>0 ( 0.0%)</td><td></td></tr>
<tr><td>entry           </td><td></td><td></td><td></td><td>0.022</td><td></td><td></td><td></td><td>0.013</td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Femoral     </td><td>36 (35.0%)</td><td>88 (40.0%)</td><td>69 (27.9%)</td><td></td><td>22 (44.0%)</td><td>45 (53.6%)</td><td>52 (34.0%)</td><td></td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Radial      </td><td>67 (65.0%)</td><td>132 (60.0%)</td><td>178 (72.1%)</td><td></td><td>28 (56.0%)</td><td>39 (46.4%)</td><td>101 (66.0%)</td><td></td></tr>
<tr><td>EF              </td><td>55.1 <U+00B1>  9.4</td><td>52.4 <U+00B1>  8.9</td><td>59.1 <U+00B1>  8.7</td><td>0.000</td><td>54.8 <U+00B1>  9.1</td><td>52.3 <U+00B1> 10.9</td><td>59.4 <U+00B1>  8.8</td><td>0.000</td></tr>
<tr><td>height          </td><td>167.5 <U+00B1>  5.7</td><td>168.7 <U+00B1>  6.0</td><td>167.3 <U+00B1>  6.4</td><td>0.055</td><td>154.2 <U+00B1>  5.1</td><td>155.7 <U+00B1>  5.4</td><td>152.6 <U+00B1>  6.7</td><td>0.002</td></tr>
<tr><td>weight          </td><td>67.5 <U+00B1>  8.4</td><td>68.8 <U+00B1> 10.9</td><td>69.0 <U+00B1> 10.6</td><td>0.479</td><td>57.2 <U+00B1> 10.3</td><td>57.4 <U+00B1>  9.0</td><td>57.1 <U+00B1>  9.1</td><td>0.978</td></tr>
<tr><td>BMI             </td><td>24.1 <U+00B1>  2.6</td><td>24.1 <U+00B1>  3.4</td><td>24.6 <U+00B1>  3.4</td><td>0.205</td><td>24.1 <U+00B1>  4.3</td><td>23.6 <U+00B1>  3.2</td><td>24.5 <U+00B1>  3.5</td><td>0.215</td></tr>
<tr><td>obesity         </td><td></td><td></td><td></td><td>0.301</td><td></td><td></td><td></td><td>0.528</td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; No          </td><td>71 (68.9%)</td><td>149 (67.7%)</td><td>153 (61.9%)</td><td></td><td>35 (70.0%)</td><td>60 (71.4%)</td><td>99 (64.7%)</td><td></td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Yes         </td><td>32 (31.1%)</td><td>71 (32.3%)</td><td>94 (38.1%)</td><td></td><td>15 (30.0%)</td><td>24 (28.6%)</td><td>54 (35.3%)</td><td></td></tr>
<tr><td>TC              </td><td>192.6 <U+00B1> 54.3</td><td>184.1 <U+00B1> 42.6</td><td>178.7 <U+00B1> 44.6</td><td>0.036</td><td>196.3 <U+00B1> 52.7</td><td>180.7 <U+00B1> 45.7</td><td>191.1 <U+00B1> 53.1</td><td>0.192</td></tr>
<tr><td>LDLC            </td><td>125.4 <U+00B1> 47.1</td><td>118.9 <U+00B1> 39.1</td><td>109.5 <U+00B1> 39.2</td><td>0.002</td><td>127.7 <U+00B1> 39.5</td><td>111.0 <U+00B1> 40.0</td><td>118.3 <U+00B1> 41.8</td><td>0.088</td></tr>
<tr><td>HDLC            </td><td>38.4 <U+00B1> 10.9</td><td>38.1 <U+00B1> 10.9</td><td>37.4 <U+00B1> 10.9</td><td>0.655</td><td>40.1 <U+00B1> 13.8</td><td>39.5 <U+00B1> 11.2</td><td>38.5 <U+00B1> 10.8</td><td>0.627</td></tr>
<tr><td>TG              </td><td>138.0 <U+00B1> 100.2</td><td>104.3 <U+00B1> 65.5</td><td>144.3 <U+00B1> 114.2</td><td>0.000</td><td>112.5 <U+00B1> 51.1</td><td>112.3 <U+00B1> 87.2</td><td>126.3 <U+00B1> 76.0</td><td>0.316</td></tr>
<tr><td>DM              </td><td></td><td></td><td></td><td>0.219</td><td></td><td></td><td></td><td>0.240</td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; No          </td><td>71 (68.9%)</td><td>154 (70.0%)</td><td>155 (62.8%)</td><td></td><td>25 (50.0%)</td><td>54 (64.3%)</td><td>94 (61.4%)</td><td></td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Yes         </td><td>32 (31.1%)</td><td>66 (30.0%)</td><td>92 (37.2%)</td><td></td><td>25 (50.0%)</td><td>30 (35.7%)</td><td>59 (38.6%)</td><td></td></tr>
<tr><td>HBP             </td><td></td><td></td><td></td><td>0.016</td><td></td><td></td><td></td><td>0.084</td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; No          </td><td>43 (41.7%)</td><td>122 (55.5%)</td><td>108 (43.7%)</td><td></td><td>19 (38.0%)</td><td>28 (33.3%)</td><td>36 (23.5%)</td><td></td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Yes         </td><td>60 (58.3%)</td><td>98 (44.5%)</td><td>139 (56.3%)</td><td></td><td>31 (62.0%)</td><td>56 (66.7%)</td><td>117 (76.5%)</td><td></td></tr>
<tr><td>smoking         </td><td></td><td></td><td></td><td>0.002</td><td></td><td></td><td></td><td>0.184</td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Ex-smoker   </td><td>34 (33.0%)</td><td>53 (24.1%)</td><td>68 (27.5%)</td><td></td><td>8 (16.0%)</td><td>13 (15.5%)</td><td>28 (18.3%)</td><td></td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Never       </td><td>13 (12.6%)</td><td>40 (18.2%)</td><td>70 (28.3%)</td><td></td><td>37 (74.0%)</td><td>57 (67.9%)</td><td>115 (75.2%)</td><td></td></tr>
<tr><td> &nbsp;&nbsp;&nbsp; Smoker      </td><td>56 (54.4%)</td><td>127 (57.7%)</td><td>109 (44.1%)</td><td></td><td>5 (10.0%)</td><td>14 (16.7%)</td><td>10 ( 6.5%)</td><td></td></tr>
</table>
myhtml function only applicable to data.frame, mytable or cbind.mytable
myhtml function only applicable to data.frame, mytable or cbind.mytable
myhtml function only applicable to data.frame, mytable or cbind.mytable

moonBook documentation built on Jan. 5, 2022, 9:06 a.m.