heatmap table

library(ztable)
library(magrittr)
options(ztable.type="html")
require(moonBook)
x=table(acs$Dx,acs$smoking)
x
z=ztable(x) 
print(z,caption="Table 1. Basic Table")

z %>% 
  addCellColor(4,3,bg="orange",color="white") %>% 
  print(caption="Table 2. Add Cell Color")

z%>%
  addRowColor(rows=1,bg="#C90000",color="white") %>%
  addCellColor(condition=Smoker>=100,cols=Smoker,color="red") %>%
  print(caption="Table 3. Conditinoal Formatting:Smoker>=100")

z %>% makeHeatmap() %>% print(caption="Table 4. Heatmap Table")


z %>% 
  makeHeatmap(palette="YlOrRd",cols=c(1,3),margin=2) %>%
  print(caption="Table 5. Columnwise heatmap table")

z%>%
  makeHeatmap(palette="YlOrRd",rows=c(1,3),margin=1) %>%
  print(caption="Table 6. Rowwise heatmap table")

你可能感兴趣的:(heatmap table)