Skip to menu

안녕하세요! 책 보며 하나씩 해보고 있습니다. 항상 감사드립니다.
table을 보기 좋게 하는 것을 연습하는데까지 왔습니다만..

script에 이렇게 입력하였더니, 최초 한번만 viewer에 표가 깔끔하게 떴습니다.
install.packages("ztable")
library(ztable)
options(ztable.type="html")
out <- mytable(Dx~LDLC+DM, data=acs)   
out
ztable(out)

지금은..console에 다음과 같이 뜹니다. 도와주세요. install.packages도 여러번 해봤지만 반복됩니다.
> out
-------------------------------------------------------- 
             Descriptive Statistics by 'Dx'            
________________________________________________________ 
            NSTEMI       STEMI     Unstable Angina   p  
           (N=153)      (N=304)        (N=400)    
-------------------------------------------------------- 
 LDLC    126.1 ± 44.7 116.7 ± 39.5  112.9 ± 40.4   0.004
 DM                                                0.209
   - No   96 (62.7%)  208 (68.4%)    249 (62.2%)        
   - Yes  57 (37.3%)   96 (31.6%)    151 (37.8%)        
-------------------------------------------------------- 



> ztable(out)
<head><style>
        table {
              font-family: times ;
color:  black ;
text-align: right;}
        th {
              padding: 1px 1px 5px 5px;
        }
        td {
             padding: 1px 1px 5px 5px; }
      </style></head><table align="center" style="border-collapse: collapse; caption-side:top; font-size:11pt;"><caption style="text-align:center;"></caption><tr>
<th <th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: hidden;border-top: 2px solid gray;"></th>
<th <th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: hidden;border-top: 2px solid gray;">NSTEMI</th>
<th <th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: hidden;border-top: 2px solid gray;">STEMI</th>
<th <th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: hidden;border-top: 2px solid gray;">Unstable Angina</th>
<th <th rowspan="2" align="center" style="font-weight: normal;border-left: 0px solid black;border-right:0px solid black;border-bottom: 1px solid gray;border-top: 2px solid gray;">p</th>
</tr>
<tr>
<th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: 1px solid gray;"></th>
<th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: 1px solid gray;">(N=153)</th>
<th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: 1px solid gray;">(N=304)</th>
<th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: 1px solid gray;">(N=400)</th>
</tr>
<tr>
<td align="left" style="border-left: 0px solid black;">LDLC   </td>
<td align="left" style="border-left: 0px solid black;">126.1 ± 44.7</td>
<td align="center" style="border-left: 0px solid black;">116.7 ± 39.5</td>
<td align="center" style="border-left: 0px solid black;">112.9 ± 40.4</td>
<td align="right" style="border-left: 0px solid black;border-right:0px solid black;">0.004</td>
</tr>
<tr>
<td align="left" style="border-left: 0px solid black;border-top: hidden;">DM</td>
<td align="left" style="border-left: 0px solid black;border-top: hidden;"></td>
<td align="center" style="border-left: 0px solid black;border-top: hidden;"></td>
<td align="center" style="border-left: 0px solid black;border-top: hidden;"></td>
<td align="right" style="border-left: 0px solid black;border-right:0px solid black;border-top: hidden;">0.209</td>
</tr>
<tr>
<td align="left" style="border-left: 0px solid black;border-top: hidden;">     No </td>
<td align="left" style="border-left: 0px solid black;border-top: hidden;">96 (62.7%)</td>
<td align="center" style="border-left: 0px solid black;border-top: hidden;">208 (68.4%)</td>
<td align="center" style="border-left: 0px solid black;border-top: hidden;">249 (62.2%)</td>
<td align="right" style="border-left: 0px solid black;border-right:0px solid black;border-top: hidden;"></td>
</tr>
<tr>
<td align="left" style="border-left: 0px solid black;border-top: hidden;">     Yes</td>
<td align="left" style="border-left: 0px solid black;border-top: hidden;">57 (37.3%)</td>
<td align="center" style="border-left: 0px solid black;border-top: hidden;">96 (31.6%)</td>
<td align="center" style="border-left: 0px solid black;border-top: hidden;">151 (37.8%)</td>
<td align="right" style="border-left: 0px solid black;border-right:0px solid black;border-top: hidden;"></td>
</tr>
<tr>
<td colspan="5" align="left" style="font-size:9pt ;border-top: 1px solid black; border-bottom: hidden;"></td>
</tr>
</table>