Commit 6a13d75e authored by Bubbi12's avatar Bubbi12

in_range function updated. Now it is possible to specify timezone for the ct function

parent 93f0ccae
......@@ -19,6 +19,7 @@
#' @param tstart The start of the period.
#' @param time The timestamps as POSIX.
#' @param tend The end of the period. If not given then the period will have no end.
#' @param timezone The timezone of the timestamps, time.
#' @return A logical vector indicating the selected period with TRUE
#' @name in_range
#' @examples
......@@ -46,12 +47,16 @@
#'
#' @export
in_range <- function(tstart, time, tend=NA) {
in_range <- function(tstart, time, tend=NA, timezone=NA) {
if (class(tstart)[1] == "character")
tstart <- ct(tstart)
if (is.na(tend))
tend <- time[length(time)]
if (class(tend)[1] == "character")
tend <- ct(tend)
ct(tstart) < time & time <= ct(tend)
if (is.na(timezone)){
timezone <- attr(D$t, "tzone")
}
ct(tstart, tz = timezone) < time & time <= ct(tend, tz = timezone)
}
Testing
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment