Yes, you want to insert date time columns together, and then force this complete row to the date object.
dat <- within(dat, datetime <- as.POSIXlt(paste(yr, mo, dy, hr, mn), format = "%Y %m %d %H %M"))
Assuming dat is an object containing buoy data. This adds new columns that are objects of the "POSIXlt" class, or you can use as.POSIXct() if you prefer a different format.
Or, by looking at the file, you can use the column names:
dat <- within(dat, datetime <- as.POSIXlt(paste(YY, MM, DD, hh, mm), format = "%Y %m %d %H %M"))
source share