Summing up values within an interval from another data.frame in R
I have thousands of entries in hkdata.2 and I want to create a loop that can help me to sum up the total exposed mxtemp from another data frame data.1 for each member in each houseID in data.2 Could any expert give me a hand on this? weather.data date mpressure mxtemp 1 2008-01-01 1025.3 15.7 2 2008-01-02 1025.6 16.0 3 2008-01-03 1023.6 18.1 4 2008-01-04 1021.8 18.4 5 2008-01-05 1020.1 20.9 6 2008-01-06 1019.7 20.7 7 2008-01-07 1018.4 24.0 8 2008-01-08 1016.7 23.7 hkdata.2 row.names houseID member male date.end date.begin 1 1 1 1 2008-01-07 2008-01-02 2 1 2 0 2008-01-06 2008-01-04 I want to