1 year ago

#303251

test-img

Ghassan M

Time format in R is showing only one value for all rows after attempting to fix it

Trying to figure out why my time formating for this dataset in R is not producing the correct outcome.

I'm attempting to fix the format in the timestamp data

This is the code I have:

intensities_h$ActivityHour=as.POSIXct(intensities_h$ActivityHour, format="%m/%d/%Y %I:%M:%S %p", tz=Sys.timezone())
intensities_h$date <- format(intensities_h$ActivityHour, format = "%m/%d/%y")
intensities_h$time <- format(intensities_h$ActivityHour, format = "%H:%M:%S")

The output is showing 00:00:00 in the time column for all rows!

Screenshot of the table view after formatting
Screenshot before formatting

Any thoughts?

r

time-format

0 Answers

Your Answer

Accepted video resources