I am pretty new to R.
I have a variable with a date and hour automatically created by the survey platform (Qualtrics) named enddate. I would like to convert that variable into minutes from midnight (the dates are shown in this format: 08/03/2020 08:17).
I tried this code I found around the web:
enddate _mins<- hour(dat$enddate) * 60 + minute(dat$enddate) / 60
but I get this error message:
Error in as.POSIXlt.character(x, tz = tz(x)) :
character string is not in a standard unambiguous format
I searched about this error and I found the following code to solve the previous issue:
enddate_num <- parse_date_time(dat$enddate, orders = "mdy HM")
I am now getting this error:
Warning message: 1306 failed to parse
I would very much appreciate your help as I don't know what else I can do.
There is a
difftime()function.Covert the string to a datetime and then use the function: