Skip to content

Commit

Permalink
Update trs.R
Browse files Browse the repository at this point in the history
for R4.3.1
  • Loading branch information
tianshu129 authored Sep 30, 2023
1 parent 60226fa commit f813881
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/trs.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ trs <- function(df, bkip, st = NULL, et = NULL, fun = 'mean', probs=0.5, na.rm =
bkip_str = tolower(bkip_str)
bkip_str = gsub("[s]", "", bkip_str)
if(bkip_str == ""|bkip_str == "ec"|bkip_str == "min"|bkip_str == "hour"){
datat[,1] = as.POSIXct(datat[,1], tz = tzlc) #"%Y-%m-%d %H:%M:%S"
temp_datime_c = lapply(as.character(datat[, 1]), function(x){ifelse(nchar(x)<11, paste0(x, " 00:00:00"), x)})
datat[, 1] = unlist(temp_datime_c)
datat[, 1] = as.POSIXct(datat[,1], tz = tzlc, format="%Y-%m-%d %H:%M:%S")
}else{
datat[,1] = as.Date(datat[,1])
datat[, 1] = as.Date(datat[,1])
}

if(wind == TRUE){
Expand Down

0 comments on commit f813881

Please sign in to comment.