Hello, I have two series, one with stream stage measurements every 5 minutes, and the other with barometric pressure measurements every hour. I want to subtract each barometric pressure measurement from the 12 stage measurements closest in time to it (6 stage measurements on either side of the hour).
I want to do something like the following, but I don't know the syntax. "If the Julian day of the stage measurement is equal to the Julian day of the pressure measurement, AND the absolute value of the difference between the time of the stage measurement and the hour of the pressure measurement is less than or equal to 30 minutes, then subtract the pressure measurement from the stage measurement (and put it in a new column in the stage data frame)." if ( stage$julian_day = baro$julian_day & |stage$time - baro$hour| <= 30 ) then (stage$stage.cm - baro$pressure) Can you help me? Thanks, JL [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.