Displaying 1 result from an estimated 1 matches for "dat_norm".
Did you mean:
d_f_norm
2024 Dec 10
1
Heat maps containing two types of variables
...-01-01"),as.Date("2024-06-01"),by="month"),
A=c(1,3,3,4,2,6),
B=c(3,5,6,4,8,9),
C=c(10,8,17,19,26,22)
)
dat_long <- pivot_longer(dat,2:4,names_to="variable",values_to="value")
normalize <- function(x) { y <- (x-min(x))/(max(x)-min(x)) }
dat_norm <- mutate(dat,across(2:4,normalize))
dat_long_norm <-
pivot_longer(dat_norm,2:4,names_to="variable",values_to="norm_value")
dat_long <- inner_join(dat_long,dat_long_norm,by=c("date","variable"))
heatmap <- ggplot(dat_long, aes(x = date, y = varia...