I am trying to plot water elevation data vs river stage and precipitation data. My Water elevation data is reported on an hourly basis while I only have daily precipitation and river stage values. Because I have them in the same dataframe, I placed all the daily measurements at the same time of 12:00:00 each day that way they would be presented in the middle of the day.
My data frame is presented as such:
   Date                River       Rain     Well 1
   1/1/2021 00:00      NA          NA       422
   1/1/2021 01:00      NA          NA       421.8
   1/1/2021 02:00      NA          NA       421.7
   1/1/2021 03:00      NA          NA       421
   1/1/2021 04:00      NA          NA       421.3
   1/1/2021 05:00      NA          NA       421
   1/1/2021 06:00      NA          NA       421
   1/1/2021 07:00      NA          NA       420.7
   1/1/2021 08:00      NA          NA       420.6
   1/1/2021 09:00      NA          NA       420.9
   1/1/2021 10:00      NA          NA       421.4
   1/1/2021 11:00      NA          NA       421.4
   1/1/2021 12:00      430         1.5      421
My issue is arising from the format of the data in the Date column which is reported as is from excel in YYYY-MM-DD HH-MM-SS format. Upon initially uploading the excel file sapply & lapply report it as a numeric in the same format as the excel.
However if I convert it using as.Date it returns it as a numeric in the format YYYY-MM-DD creating 24 YYYY-MM-DD values in my date column for each day. I was using the following code to transform it:
   df <- df %>% transform(Date = as.Date(Date))
I have also tried to use:
  df <- df %>% ymd_hms(Date)
However this gives an error and replaces all values in the Date column with NA.
When I plot the data after I use as.Date it only reports a single measurement for each day instead of the hourly data. However when I don't transform the Date and leave it as is, I get the error:
   Error: Invalid input: date_trans works with objects of class Date only
All other data is in numeric format. Really appreciate any kind of help.
 
    