I have a data frame
a <- data.frame(list(wind_speed=c(21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0), power=c(29, 171, 389, 703, 1139, 1682, 2205, 2700, 2700)))
which shows the (theoretical) relationship between wind speed and power, e.g. if wind speed is 21 then power is 29. Now the two measured wind speeds are
b <- c(21.5, 27.2)
I would like the effective power production, e.g. 21.5 falls in between 21 and 22 and therefore the result is (29+171)/2. Or for 27.2: 0.8*2205+0.2*2700=2304