Converts physical dates to event dates.

Description

Given a zoo time-series vector and an event date, it converts the physical date to the event date. The event date becomes zero and all other dates shift accordingly.

Usage

1
phys2eventtime(z, events, width = 10)

Arguments

z

Time series data for which event frame is to be generated.

events

It is a data frame with two columns: unit and when. unit has column name of which response is to measured on the event date, while when has the event date.

width

Width corresponds to the number of days on each side of the event date.For a given width, if there is any NA in the event window then the last observation is carried forward.

Value

Output is in a list format. A zoo object indexed with event time and a vector which describes the status of each unit in the original data.

Examples

1
2
3