我有这个数据框:
tides <- data.frame("time"= c("08:35", "14:28", "13:10", "13:25", "14:30", "12:20"),
"tide 1"= c("04:18 H", "03:54 L", "03:36 H", "02:00 L", "03:54 H", "05:54 H"),
"tide 2"= c("10:30 L", "10:30 H", "09:48 L", "08:18 H", "10:06 L", "12:06 L"),
"tide 3"= c("16:42 H", "16:36 L", "16:00 H", "14:24 L", "16:12 H", "18:12 H"),
"tide 4"= c("22:48 L", "23:00 H", "22:06 L", "20:36 H", "22:24 L", "00:30 L"),
stringsAsFactors = FALSE)
time tide.1 tide.2 tide.3 tide.4
1 08:35 04:18 H 10:30 L 16:42 H 22:48 L
2 14:28 03:54 L 10:30 H 16:36 L 23:00 H
3 13:10 03:36 H 09:48 L 16:00 H 22:06 L
4 13:25 02:00 L 08:18 H 14:24 L 20:36 H
5 14:30 03:54 H 10:06 L 16:12 H 22:24 L
6 12:20 05:54 H 12:06 L 18:12 H 00:30 L
我需要确定time
列中的时间是涨潮还是退潮。这些tide
列给出了当天的低潮和高潮时间。
l = 低潮,h = 高潮。
有没有一种有效的方法来做到这一点?