I had 6 numeric columns of year, month, day, hour, min and sec, and combined them using make_datetime in the lubridate package, as such:
data$date <- make_datetime(year = data$Year, month = data$Month, day = data$Day, hour = data$Hour, min = data$Min, sec = data$Sec)
However, the class of the new date column is unknown. When I investigated with class(data$date), it returns "POSIXct" "POSIXt". I tried fixing it with:
class(data$date) <- "POSIXct"
When I hover over the header in the data table, the class remains unknown. But when I put class(data$date) in the command line, it returns "POSIXct". I suspect that I have not resolved the issue because I cannot use other functions like timeAverage (openair).
Does anyone know if this is normal for make_datetime, and if I can fix this? Thanks
EDIT
This is the head(data)
 Year Month Day Hour Min Sec                Date
1: 1979     1   1    0   0   0 1979-01-01 00:00:00
2: 1979     1   1    1   0   0 1979-01-01 01:00:00
3: 1979     1   1    2   0   0 1979-01-01 02:00:00
4: 1979     1   1    3   0   0 1979-01-01 03:00:00
5: 1979     1   1    4   0   0 1979-01-01 04:00:00
6: 1979     1   1    5   0   0 1979-01-01 05:00:00
 
     
    