# df.CB starts at 2019-01-01 00:00:00 and ends at 2020-05-19 00:00:00 # df.raw starts at 2018-01-01 00:00:00 and ends at 2020-05-19 00:00:00 TimeMin = which(df.raw$Time == min(df.CB$Time)) TimeMax = which(df.raw$Time == max(df.CB$Time)) df.raw = df.raw[TimeMin:TimeMax, ]