I'm trying to write a script that will scan a table for times, and those that happen to be past 6pm will be changed to be 6am of the following day. I have tried using the lubridate package (ymd_hms), but the problem is that it forces me to specify a date (I would like to just use the current system date).
I am kind of new to R (and programming in general) so I'm having trouble wrapping my head around how factors, variables and all that works.
endTime <- ymd_hms("x 18:00:00", tz = "America/Chicago")
Ideally I would want the "x" to take on the system date (no time), but lubridate won't let me do that as it only wants a numerical date in there, it won't let me assign some date to a name and use that.
After that, this should happen
for (Time in firstTen) {
if (tables$Time > endTime ) {
dateTime = ymd_hms("x+1 06:00:00")
}
}
I know the code isn't functional but I just want to give you an idea of what I have in mind.
Any help appreciated!