Created
November 13, 2019 12:55
-
-
Save stevepowell99/8c5d59d3d1af13a3c1693f2358314e25 to your computer and use it in GitHub Desktop.
heatmaps for UNICEF ECARO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(readxl) | |
suppressMessages(library(dendextend)) | |
library(d3heatmap) | |
data <- readxl::read_excel("Data.xlsx",range="A3:CU24",na="NK") | |
mat=data %>% select(-(1:3)) | |
rownames(mat) <- data[1:21,1] | |
mat2 <- mat %>% | |
select_if(~sum(!is.na(.)) > 0) | |
vec <- unclass(data[1:21,1]) %>% as.vector %>% `[[`(1) | |
d3heatmap(mat2,labRow = vec,xaxis_height = 200) | |
policy <- mat2 %>% select(contains("Policy Design")) | |
policy %>% | |
d3heatmap(labRow = vec,xaxis_height = 200) | |
financing <- mat2 %>% select(contains("Financing")) | |
financing %>% | |
d3heatmap(labRow = vec,xaxis_height = 200) | |
coordination <- mat2 %>% select(contains("Coordination")) | |
coordination %>% | |
d3heatmap(labRow = vec,xaxis_height = 200) | |
implementation <- mat2 %>% select(contains("Implementation")) | |
implementation %>% | |
d3heatmap(labRow = vec,xaxis_height = 400,yaxis_width = 200) | |
combined <- (policy+financing+coordination+implementation) | |
colnames(combined) <- str_remove(colnames(combined)," - Policy Design") | |
combined %>% | |
d3heatmap(labRow = vec,xaxis_height = 400,yaxis_width = 200) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment