hhmm2hour: Function to convert time in format hhmm to decimal hours....

Description Usage Arguments Value Author(s) Examples

View source: R/fdbk_asdataframe.R

Description

Function to convert time in format hhmm to decimal hours. Useful to calculate a derived time from two time informations

Usage

1

Arguments

time

in format hhmm. Can be a string or numeric

Value

time in decimal hours

Author(s)

Felix <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#EXAMPLE 1 simple examples
hhmm2hour(0145) returns 1.75
hhmm2hour(145) returns 1.75
hhmm2hour("145") returns 1.75

#EXAMPLE 2 calculate leadtime from veri_forecast_time and time
require(ggplot2)
fnames       = "/Users/josuegehring/Desktop/verTEMP.2014120112"
cond        = list(obs="!is.na(obs)",varno="varno%in%c(2,3,4,29)",ident="ident%in%c(6610)",varno="varno%in%c(2)")
columnnames = c("obs","veri_data","varno","state","level","veri_forecast_time","time","ident")
DT          = fdbk_dt_multi_large(fnames,cond,columnnames,1)
leadtime = hhmm2hour(DT$veri_forecast_time) + DT$time/60
DT[,"leadtime"] = leadtime

rfxf/Rfdbk documentation built on Dec. 17, 2018, 9:14 a.m.