I have a data set of start and end times of when a reef is exposed during low tide. I am trying to create a new column called "interval" using the lubridate::interval function. I have about 400 rows of data.
https://github.com/LCRoysterproject/bird/blob/STEVEN-L--DEVELOPMENT/data/birdcamtides.csv
Site Start.Date.Time End.Date.Time
1 LCOR_1 2017-11-08 13:20:00 2017-11-08 15:00:00 2 LCOR_1 2017-11-09 08:40:00 2017-11-09 15:45:00 3 LCOR_1 2017-11-10 09:20:00 2017-11-10 18:30:00 4 LCOR_1 2017-11-11 10:00:00 2017-11-11 18:55:00 5 LCOR_1 2017-11-12 12:05:00 2017-11-12 18:30:00 6 LCOR_1 2017-11-13 13:40:00 2017-11-13 18:55:00 7 LCOR_1 2017-11-14 07:35:00 2017-11-14 09:10:00 8 LCOR_1 2017-11-14 14:45:00 2017-11-14 18:55:00 9 LCOR_1 2017-11-15 07:30:00 2017-11-15 10:30:00 10 LCOR_1 2017-11-15 15:50:00 2017-11-15 18:55:00
library(lubridate)
tides <- read.csv("data/birdcamtides.csv", header = T)
tides$Start.Date.Time <- paste(tides$Date, tides$Start.Low.Tide)
tides$End.Date.Time <- paste(tides$Date, tides$End.Low.Tide)
tides$Start.Date.Time <- mdy_hm(tides$Start.Date.Time, tz = 'EST')
tides$End.Date.Time <- mdy_hm(tides$End.Date.Time, tz = 'EST')
tides$interval <- interval(tides$Start.Low.Tides,
tides$End.Low.Tide)
I keep getting the error "Error in as.POSIXlt.character(as.character(x), ...) : character string is not in a standard unambiguous format"
I don't understand how I am getting this error, since all of my dates are in the POSIX.ct format. My question is different because I am trying to write a function or something to create a new column with an interval for each corresponding start and end time.