makeHeatmap: Add gradient background color to ztable

Description Usage Arguments Examples

View source: R/makeHeatmap.R

Description

Add gradient background color to ztable

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
makeHeatmap(
  z,
  palette = "Reds",
  mycolor = NULL,
  rows = NULL,
  cols = NULL,
  changeColor = TRUE,
  reverse = FALSE,
  margin = 0
)

Arguments

z

An object of class ztable

palette

Name of color palette

mycolor

user defined color vectors

rows

columns to make heatmap

cols

columns to make heatmap

changeColor

Logical. Whether of not change font color automatically

reverse

If true, reverse the font color

margin

An integer. Choices are one of 0,1 and 2. 0(default), heatmap for all numeric data. 1 ; rowwise heatmap, 2: columnwise heatmap.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
require(magrittr)
ztable(head(mtcars)) %>% makeHeatmap()
## Not run: 
ztable(head(mtcars)) %>% makeHeatmap(palette="YlOrRd",cols=c(1,4,6),margin=2)
ztable(head(mtcars)) %>% makeHeatmap(rows=c(1,3,5),margin=1)
require(moonBook)
x=table(acs$smoking,acs$Dx)
ztable(x) %>% makeHeatmap
ztable(x) %>% makeHeatmap(palette="Blues")
ztable(x) %>% makeHeatmap(mycolor=gradientColor(low="yellow",mid="orange",high="red"))

## End(Not run)

Example output

Welcome to package ztable ver 0.2.0
Loading required package: magrittr
sh: 0: Can't open /dev/null
sh: 0: Can't open /dev/null
Loading required package: moonBook
sh: 0: Can't open /dev/null
sh: 0: Can't open /dev/null
sh: 0: Can't open /dev/null
sh: 0: Can't open /dev/null

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