I have a big dataframe with a p-values column that loosk like the snippet below
myPvalues<-data.frame(pvalues=c(0.00431279265850473,NA,0.00067818958352233,NA,NA,NA,0.00826354450511943,0.00605467431746949,0.00518801869607421,0.00896893103806155))
I would like to map those values to colors, by using a heat map either already defined or to be created. I understand how to make a plot which colors my data in the proper way, but I don't know how I can add a column to my data frame that save those values for the colors, such that the data frame now has also a column like
myPvalues$Colors<-c("#75F4A1","#FFFFFFFF","#547CB8","#FFFFFFFF","#FFFFFFFF","#FFFFFFFF","#F9A13A","#D6F667","#92FC79","#F58046")
where "white" is for NA values, and the other values are codes for colors (here, I put arbitrary codes but they would need to be colors from a color gradient with extremes defined by min(myPvalues$pvalues) and max(myPvalues$pvalues).
I have been looking around but found no solution that quite addresses this problem. Would anybody give me a pointer?