made R code to calculate water R. the final data frame is incomplete