First, we need to convert the given data points into a data frame.
# given data points
key_days <- c(1,2,3,45,46,84,86,87)
flow_rates <- c(0,0,62000,57500,59800,55200,53000,0)
flow_data <- data_frame(key_days,flow_rates)
We can use connector() to create a piece-wise linear function from the data:
flow<-connector(flow_rates ~ key_days, data=flow_data)
The connector() returns a function of time in days, named flow. This is the R function representing the piece-wise linear, continuous mathematical function \(\text{flow}(t)\) that connects linearly the data points. We can visualize the given data points along with the interpolating function \(\text{flow}(t)\).