event: Event Constructor

Description Usage Arguments Value Examples

View source: R/event.R

Description

Event constructor

Usage

1
2
3
4
5
new_event(id = uuid::UUIDgenerate(), type, time = Sys.time(), ...)

validate_event(id, type, time, ...)

event(id = uuid::UUIDgenerate(), type, time, ...)

Arguments

id

A character identifier

type

A character indicating the event type

time

A character string indicating the event timestamp

...

A list with the event attributes.

Value

The function returns an object of class event. event objects are implemented as a list of two main elements: A head and a body.The head contains an identifier (id), a string indicating the event type (type) and a POSIXct object indicating when the event occurs (time). The body containts the event attributes defined by the user. By default id is generated using uuid and time value is the result of Sys.time() function by default.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
birth_event <- event(
  id = 'first-id',
  type = 'BIRTH',
  time = '1936-11-09',
  birth_date = '1936-11-09'
)

death_event <- event(
  id = 'second-id',
  type = 'DEATH',
  time = '2019-05-22',
  death_date = '2019-05-22'
)

eventr documentation built on July 8, 2020, 7:32 p.m.