I am trying to make new column by performing an equation that puts each Port's Value within a given day inputted along with its Port_max for that day. The Port_max is associated with its Timestamp of when it occurs. and the equation is *119((max value/Value)-1)^1.231
I initially tried df1 <- df %>% mutate(x = 119*((df$Port_max/df$Value)-1)^1.231) didn't work because there is only 1 value per day per port for the Port_max
Sample of the dataframe that covers 6 weeks 24hrs/day:
Timestamp Port Value Port_max
2021-05-19 00:00:00 1 0.66 0.66
2021-05-19 00:00:00 2 0.57 0.57
2021-05-19 00:00:00 3 0.47 NA
2021-05-19 00:00:00 4 0.83 0.83
2021-05-19 00:00:00 5 0.70 NA
2021-05-19 00:00:00 6 0.81 NA
2021-05-19 00:15:00 1 0.55 NA
2021-05-19 00:15:00 2 0.62 NA
2021-05-19 00:15:00 3 0.76 0.76