str(sleep_data)
'data.frame': 413 obs. of 5 variables:
Id : num 1503960366 1503960366 1503960366 1503960366 1503960366 ...
SleepDay : chr "4/12/2016 12:00:00 AM" "4/13/2016 12:00:00 AM" "4/15/2016 12:00:00 AM" "4/16/2016 12:00:00 AM" ...
TotalSleepRecords : int 1 2 1 2 1 1 1 1 1 1 ...
TotalMinutesAsleep: int 327 384 412 340 700 304 360 325 361 430 ...
$ TotalTimeInBed : int 346 407 442 367 712 320 377 364 384 449 ...
i need to convert sleepday into date time and split into seperate columns.
"sleep_data$date <- mdy_hms(sleep_data$date_time)"
I used the above code and was able to create a date column
"$ date : POSIXct, format: "2016-04-12" "2016-04-13" ..."
I'not able to create a time column.
Can someone help me with the correct code