0

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")
zx8754
  • 52,746
  • 12
  • 114
  • 209
  • 2
    Hi and welcome! Could you edit your question to be reproducible? Right now, there is insufficient information to provide accurate help. Tips on how to make your question reproducible are [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – jpsmith Jul 11 '23 at 07:19
  • Does this answer your question? [Splitting a column into date/time in tidyverse](https://stackoverflow.com/questions/62398371/splitting-a-column-into-date-time-in-tidyverse) – Liang Zhang Jul 11 '23 at 07:26
  • Hi! Welcome! Please run `dput(weight)` in R and add the output to your question – Mark Jul 11 '23 at 08:05

0 Answers0