I am working on the Google Data Analytics project about Bellabeats. I need to format the Weight data set in the Date column. The date and time were in the same column, I wanted to create two columns. one for date, one for time.
Here is what I did, and it resulted in deleting the entire column. I wanted to split it into two columns.
weight$Date= as.POSIXct(weight$Date, format = "%M/%d/%Y %I: %M :%S %p" , tz=Sys.timezone())
weight$time <- format(weight$Date, format = "%H: %M: %S")
weight$date<-format(weight$Date, format = "%m/%d/%Y")