changing date to POSIX.ct and removing unwanted dates? R

Viewed 26

I need to make datetime a POSIX in the format mm:dd:yyyy, hh:mm:ss and keep only dates that are in year 2022. everything I have tried has deleted the data

data example

rain_pnm <-
  structure(
    list(
      datetime = c(
        "10/03/2011 12:20:00",
        "10/03/2011 12:25:00",
        "10/03/2011 12:30:00",
        "10/03/2011 12:35:00",
        "10/03/2011 12:40:00"
      ),
      date = c(
        "10/03/2011",
        "10/03/2011",
        "10/03/2011",
        "10/03/2011",
        "10/03/2011"
      ),
      ra = c(0, 0, 0, 0, 0),
      raw = c(0, 0, 0, 0, 0),
      chk_note = c("good", "good", "good", "good", "good"),
      chk_fail = c(
        NA_character_,
        NA_character_,
        NA_character_,
        NA_character_,
        NA_character_
      )
    ),
    row.names = c(NA,-5L),
    class = c("tbl_df", "tbl", "data.frame")
  )

Ideally would then add this to another ggplot as an additional variable.

0 Answers
Related