Delay: Delay function for time series

Description Usage Arguments Value Author(s) Examples

View source: R/Delay.R

Description

This function allows to cretae a n-time steps delayed time series, where n is the number of time steps defined by argument x. Henceforth, it is possible to calibrate this argument (parameter) x.

Usage

1
  Delay(P1, x)

Arguments

P1

A data.frame that contains the time series of the environmental variable to be delayed, e.g. precipitation. This data.frame should have at least two columns: the first one, Time [y-m-d h:m:s]; the second one, a numeric value equal to the magnitude of the environmental variable. If the environmental variable is different than precipitation, then the column name of the values should be named as value.

x

A numeric value that specifies the delayed time in time steps.

Value

A data.frame with two columns:

time

the date-time time series of the delayed variable

value

time series with the magnitude (equal to the original, P1, time series) of the delayed variable.

Author(s)

J.A. Torres-Matallana

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(EmiStatR)
data(P1)

P1_delayed <- Delay(P1 = P1, x = 500)

head(P1_delayed)

dev.new()
par(mfrow = c(2, 1))
plot(P1[,1], P1[,2], typ = "l", col = "blue")
plot(P1_delayed[,1], P1_delayed[,2], typ= "l", col = "red")

Example output

                 time P [mm]
1 2016-01-04 10:20:00      0
2 2016-01-04 10:30:00      0
3 2016-01-04 10:40:00      0
4 2016-01-04 10:50:00      0
5 2016-01-04 11:00:00      0
6 2016-01-04 11:10:00      0

EmiStatR documentation built on Sept. 28, 2021, 9:08 a.m.