DB_envt
datetime STUDY_SITE DATE_ENV GROUP_ENV TIME_ENV Depth Seastate SST Offshore Habitat Tide Behaviour
1 2010-6-30 12:41:00 HongKong 30-Jun-10 1 12:41:00 NA 1 NA NA NS Ebb Rest
2 2010-6-30 13:13:00 HongKong 30-Jun-10 1 13:13:00 NA 2 NA NA NS Ebb Rest
3 2010-6-30 13:56:00 HongKong 30-Jun-10 2 13:56:00 NA 1 NA NA NS Ebb Rest
4 2010-7-01 11:01:00 HongKong 01-Jul-10 1 11:01:00 NA 1 NA 30 High Rest
5 2010-7-01 11:38:00 HongKong 01-Jul-10 1 11:38:00 NA 1 NA 40 High Rest
6 2010-7-01 11:38:00 HongKong 01-Jul-10 2 11:38:00 NA 1 NA 40 High Rest
DB_gps
datetime PKey STUDY_SITE DATE_SIGHT GROUP_SIGHT SPECIES TIME_SIGHT LATITUDE LONGITUDE
1 2010-5-18 11:45:00 269253 HongKong 18-May-10 1 Sc 11:45:00 22.29043 113.8933
2 2010-5-18 12:50:00 269254 HongKong 18-May-10 3 Sc 12:50:00 22.26373 113.8597
3 2010-6-30 12:41:00 269241 HongKong 30-Jun-10 1 Sc 12:41:00 22.22835 113.8360
4 2010-6-30 12:51:00 269242 HongKong 30-Jun-10 1 Sc 12:51:00 22.21963 113.8380
5 2010-6-30 12:53:00 269243 HongKong 30-Jun-10 1 Sc 12:53:00 22.22932 113.8374
6 2010-6-30 13:10:00 269244 HongKong 30-Jun-10 1 Sc 13:10:00 22.23020 113.8373
我有两个数据帧,我想将DB_gps数据的最近时间点合并到DB_envt,假设在2分钟范围内,并且如果在该时间内没有GPS数据,则为该行数据产生NaN + - 2分钟范围。我该怎么做R?