Convert duration time value

Asked

Viewed 26 times

0

I need to convert the values of an attribute that is in the duration time format hh:mm:ss to a value where I can correlate with another attribute in a boxplot.

The data are as follows::

structure(list(tempoEngajamento = structure(c(13L, 21L, 23L, 
24L, 11L, 19L, 25L, 14L, 29L, 18L, 10L, 20L, 7L, 27L, 12L, 4L, 
3L, 6L, 5L, 17L, 2L, 15L, 30L, 16L, 1L, 22L, 28L, 26L, 9L, 8L
), .Label = c("06:53:42", "07:22:22", "104:45:25", "12:53:32", 
"13:28:46", "15:21:12", "15:32:58", "16:36:56", "17:45:46", "19:47:31", 
"20:03:48", "21:14:59", "21:51:09", "22:42:40", "22:43:54", "24:15:09", 
"24:28:28", "25:45:46", "29:55:38", "32:52:21", "32:53:01", "42:24:07", 
"42:35:04", "44:14:25", "49:11:58", "49:42:53", "62:24:01", "64:04:40", 
"76:06:17", "81:25:04"), class = "factor"), notaFinal = c(23.95, 
25.4, 31.55, 25.4, 27.8, 27.3, 31.85, 20.45, 31.95, 28.55, 20, 
24.95, 14.45, 22.55, 25.65, 10.35, 27.95, 21.45, 18.45, 21.1, 
12.3, 22.65, 30.35, 27.4, 12.85, 21.95, 26.25, 28.55, 24.3, 22.35
)), .Names = c("tempoEngajamento", "notaFinal"), row.names = c(NA, 
-30L), class = "data.frame")

I need to correlate the value of column 1 with that of column 2, but for this the value of column 1 needs to be converted to an equivalent value.

  • I found this answer in my research, but the function Marcus Nunes gave converts only one value. In my case I have several values in a dataframe, and I can’t convert all the values of column 1 with the function he suggested.

  • I was able to solve through the answer given by Marcus Nunes, I only had to play the function in a for to convert line to line my dataframe.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.