output:
pnscopy = pns
pnscopy$size <- as.numeric(pnscopy$size)
pnscopy$gender <- as.numeric(pnscopy$gender)
pnscopy$age <- as.numeric(pnscopy$age)
pnscopy$edu <- as.numeric(pnscopy$edu)
pnscopy$wealth <- as.numeric(pnscopy$wealth)
pnscopy = scale(pnscopy)
pnscopy = normalize(pnscopy)
pnscopy = percentize(pnscopy)
which produced the following dataframe:
Heatmaps in progress, having issues with heatmaply
Still can’t get heatmaply to work, still getting the following error despite trying Caroline’s workaround:
Error in hclustfun(dist) : must have n >= 2 objects to cluster
pns_prep2 <- slice_sample(pnscopy, n = 1000, replace = FALSE)
pns_matrix2 <- data.matrix(pns_prep2)
pns_heatmap2 <- heatmap(pns_matrix2, Rowv=NA, Colv=NA,
col = cm.colors(256), scale="column", margins=c(5,10))
png(file = "./DHS/pns_heatmap2.png")
heatmap(pns_matrix2)
dev.off()
which produced the following plot:
After trying that workaround, I tried running the heatmaply function on the pnscopy dataframe, where all columns were numeric. The heatmaply functions then worked correctly, and created the following plots (which seem to be so large that the axis labels are unreadable):
raw:
scaled:
normalized:
percentized: