Hi all,
I'm a self-taught R practitioner(beginner basically ). I am creating my portfolio project and I got such with date/time conversion.
I have a data set in which the data is in Chr format.it contains both the date and time together. I created two new columns for date and time and split the existing date column accordingly. The new columns are also created in CHR format. I am able to convert the data column into data format but not the time column. I tried multiple functions but they either give an error or show NA. I tried a new method but it's not accurate when I try to plot. Can someone please let me know how can I convert the time into the correct format?
intensity_per_hour_clean<- intensity_per_hour
intensity_per_hour_clean[c('Date', 'Time')] <- str_split_fixed(intensity_per_hour_clean$ActivityHour, " ",2)
intensity_per_hour_clean$Time<- hms::as_hms(intensity_per_hour_clean$Time)
Plotting issue:
I want to show the average intensity throughout the day but cos of the wrong time formatting it's not plotting what it's supposed to be.
ggplot(data=intensity_per_hour_clean, aes(x= Time , y= AverageIntensity))+geom_bar(stat = "identity", fill="blue")+
theme(axis.text.x = element_text(angle = 90))+
labs(title = "Time of The Day vs. Avg. Intensities")
Please, anyone, let me know how to fix this, I have been stuck here for a couple of days now!!