Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. HoraDecimal <- function(x){
  2. sum(unlist(lapply(strsplit(x, split=":"), as.numeric)) * c(1, 1/60, 1/3600))
  3. }
  4.  
  5. x <- "02:20:00"
  6. HoraDecimal(x)
  7. [1] 2.333333
  8.  
  9. y <- "00:50:00"
  10. HoraDecimal(y)
  11. [1] 0.8333333
  12.  
  13. z <- "3:30:30"
  14. HoraDecimal(z)
  15. [1] 3.508333
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement