create_ejEvent: Create an event

Description Usage Arguments Value Examples

View source: R/constructors.R

Description

This function defines events output ejEvent

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#' #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))

repijson documentation built on May 29, 2017, 2:12 p.m.