Learn R Programming

eventr (version 1.0.0)

new_event: Event Constructor

Description

Event constructor

Usage

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

Run this code
# NOT RUN {
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'
)

# }

Run the code above in your browser using DataLab