Learn R Programming

repijson (version 0.1.0)

create_ejEvent: Create an event

Description

This function defines events output ejEvent

Usage

create_ejEvent(id = NA, name, date = NULL, location = NULL, attributes = list())

Arguments

id
identifier for the event
name
name of the event, usually a column name
date
date (or timestamp) for event
location
location for event
attributes
list of attributes associated with this event

Value

an ejEvent object

Examples

Run this code
#' #generate a polygon
library(sp)
polyPoints <- matrix(c(526870,181390,526817,181447,526880,181467,
		526885,181447,526909,181425,526870,181390),ncol=2,byrow=TRUE)
demoPolygon <- sp::SpatialPolygons(list(sp::Polygons(list(sp::Polygon(polyPoints)),"1")),
		proj4string=sp::CRS("+init=epsg:27700"))


#Create an attribute
integerAttribute <- create_ejAttribute(name="Days since last accident", type="integer",
  value=integer(2))
logicalAttribute <- create_ejAttribute(name="Customer satisfied", type="boolean",
  value=TRUE)

#create an event
event <- create_ejEvent(id=1, name="A test Event", date=Sys.time(),
		location=demoPolygon, attributes=list(integerAttribute, logicalAttribute))

Run the code above in your browser using DataLab