rvn_ts_infill {RavenR} | R Documentation |
Infill discontinuous time series with blank values
Description
Infills missing time values from a time series based on a regular interval.
Usage
rvn_ts_infill(ts)
Arguments
ts |
valid xts time series |
Details
Takes xts dataset, finds minimum interval between time stamps and
returns a new regular interval xts with same data content, but NA
values in between known
data values
Only handles data with minimum time interval of 1 day; 1,2,3,4,6,8, or 12 hrs.
Note that in default reading in of date/time data, the daylight savings timezones may be assigned
to the date/time when reading in a data file with Raven using functions such as rvn_hyd_read
. This
function will then detect differences in the intervals and throw an error. To avoid this, the
timezone may be assigned explicitly to all values with the read function and all daylight savings/endings
will be ignored.
Value
ts |
continuous xts time series |
Author(s)
James R. Craig, University of Waterloo
Examples
system.file("extdata","run1_Hydrographs.csv", package="RavenR") %>%
rvn_hyd_read(., tzone="EST") -> mydata
mydata <- mydata$hyd$precip
mydata<-mydata[-seq(2,nrow(mydata),3),] # remove every 3rd day
head(mydata)
# fill back with rvn_ts_infill using NA values
rvn_ts_infill(mydata$precip) %>%
head()