Skip to content

Commit

Permalink
towards fixing #158
Browse files Browse the repository at this point in the history
  • Loading branch information
njtierney committed May 3, 2018
1 parent 9a84dff commit 329a3e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ S3method(miss_var_table,grouped_df)
S3method(replace_to_na,data.frame)
S3method(replace_with_na,data.frame)
S3method(shadow_shift,"NULL")
S3method(shadow_shift,POSIXct)
S3method(shadow_shift,character)
S3method(shadow_shift,default)
S3method(shadow_shift,factor)
Expand Down
18 changes: 18 additions & 0 deletions R/shadow-shifters.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,21 @@ shadow_shift.character <- function(x, ...){
true = "missing",
false = x)
}

#' @export
shadow_shift.POSIXct <- function(x,
this_origin = "1970-01-01",
...){

# dat_date <- data.frame(date = as.POSIXct(c(111,
# 112,
# 150,
# NA,
# 160),
# origin = "1970-01-01"))

shifted <- as.integer(shadow_shift(as.numeric(x)))

as.POSIXct(shifted,
origin = this_origin)
}

0 comments on commit 329a3e1

Please sign in to comment.