addCellColor: Add column colors of an object of ztable

Description Usage Arguments Examples

View source: R/ztable2.R

Description

Add column colors of an object of ztable

Usage

1
2
3
4
5
6
7
8
addCellColor(
  z,
  rows = NULL,
  cols = NULL,
  bg = NULL,
  color = NULL,
  condition = NULL
)

Arguments

z

An object of ztable

rows

An integer vector indicating specific rows

cols

An integer vector indicating specific columns

bg

A character vector indicating background color

color

A character vector indicating color

condition

Logical expression to select rows

Examples

1
2
3
4
5
6
7
8
## Not run: 
z=ztable(head(iris))
z=addRowColor(z,c(1,3),color="platinum")
z=addColColor(z,2,color="cyan")
z=addCellColor(z,cols=c(5,4),rows=5,color="red")
z

## End(Not run)

Example output

Welcome to package ztable ver 0.2.2
<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 style="border-left: 0px solid black;background-color: #FFFFFF;border-top: 2px solid gray;border-bottom: 1px solid gray;">&nbsp;</th>
<th <th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: 1px solid gray;border-top: 2px solid gray;color: #00FFFF;">Sepal.Length</th>
<th <th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: 1px solid gray;border-top: 2px solid gray;color: #E5E4E2;">Sepal.Width</th>
<th <th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: 1px solid gray;border-top: 2px solid gray;color: #E5E4E2;">Petal.Length</th>
<th <th align="center" style="font-weight: normal;border-left: 0px solid black;border-bottom: 1px solid gray;border-top: 2px solid gray;color: #E5E4E2;">Petal.Width</th>
<th <th 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;color: #E5E4E2;">Species</th>
</tr>
<tr>
<td  style="border-left: 0px solid black; ">1</td>
<td align="right" style="border-left: 0px solid black;color: #00FFFF;">5.10</td>
<td align="right" style="border-left: 0px solid black;">3.50</td>
<td align="right" style="border-left: 0px solid black;">1.40</td>
<td align="right" style="border-left: 0px solid black;">0.20</td>
<td align="left" style="border-left: 0px solid black;border-right:0px solid black;">setosa</td>
</tr>
<tr>
<td  style="border-left: 0px solid black; border-top: hidden;color: #E5E4E2; ">2</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #00FFFF;">4.90</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #E5E4E2;">3.00</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #E5E4E2;">1.40</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #E5E4E2;">0.20</td>
<td align="left" style="border-left: 0px solid black;border-right:0px solid black;border-top: hidden;color: #E5E4E2;">setosa</td>
</tr>
<tr>
<td  style="border-left: 0px solid black; border-top: hidden;">3</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #00FFFF;">4.70</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">3.20</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">1.30</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">0.20</td>
<td align="left" style="border-left: 0px solid black;border-right:0px solid black;border-top: hidden;">setosa</td>
</tr>
<tr>
<td  style="border-left: 0px solid black; border-top: hidden;">4</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #00FFFF;">4.60</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">3.10</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #FF0000;">1.50</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #FF0000;">0.20</td>
<td align="left" style="border-left: 0px solid black;border-right:0px solid black;border-top: hidden;">setosa</td>
</tr>
<tr>
<td  style="border-left: 0px solid black; border-top: hidden;">5</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #00FFFF;">5.00</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">3.60</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">1.40</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">0.20</td>
<td align="left" style="border-left: 0px solid black;border-right:0px solid black;border-top: hidden;">setosa</td>
</tr>
<tr>
<td  style="border-left: 0px solid black; border-top: hidden;">6</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;color: #00FFFF;">5.40</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">3.90</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">1.70</td>
<td align="right" style="border-left: 0px solid black;border-top: hidden;">0.40</td>
<td align="left" style="border-left: 0px solid black;border-right:0px solid black;border-top: hidden;">setosa</td>
</tr>
<tr>
<td colspan="6" align="left" style="font-size:9pt ;border-top: 1px solid black; border-bottom: hidden;"></td>
</tr>
</table>

ztable documentation built on Sept. 28, 2021, 9:07 a.m.