Dear colleagues,
I am learning how to make a heatmap
right now from an existing data frame. The data frame is at the link; https://www.dropbox.com/s/rp7e5zbjyowtyor/time_crime_pct.csv?dl=0
The goal is to get Primary.Type
on the y-axis and time
on the x-axis, whereas crime_percent
should be represented by proper intensity color in given cell. As we know, the data frame needs to be converted into a Data matrix before drawing Heatmap. But the Data matrix converts logical/factor columns to internal numeric codes. But that is not so useful for my analysis.
The reason being, if the column Primary.Type
is replaced by numeric codes, the rendered heat map will be quite incomprehensible for the audience. Therefore, I am working on retaining the factor column with its original values. One attempt was to set row names same as Primary.Type
, but I realized that the column Primary.Type
is not distinct hence can't be used as row names.
Can I kindly get help on how to retain the proper values for the factor variable and be able to sketch my heat map?
Advice/help is greatly appreciated.