Skip to content

Commit

Permalink
added numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Rinker committed Aug 18, 2017
1 parent 83a3215 commit 1a085fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/f_12_hour.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ f_12_hour.integer <- function(x, format = '%I:%M %p', pad.char = '', ...){
}


#' @export
#' @rdname f_12_hour
#' @method f_12_hour numeric
f_12_hour.numeric <- function(x, format = '%I:%M %p', pad.char = '', ...){

x <- as.integer(x)
out <- format(as.POSIXct(paste0("2017-08-18 ", ifelse(nchar(x) == 1, '0', ''), x, ":00:00"), origin = "1960-01-01"), format=format)

gsub('^0', pad.char, out)

}

#' @export
#' @include utils.R
Expand Down

0 comments on commit 1a085fe

Please sign in to comment.