Learn R Programming

repijson (version 0.1.0)

create_ejAttribute: Create an attribute This package outlines the aspects of the data for EpiJSON

Description

This function defines attributes output ejAttribute

Usage

create_ejAttribute(name, type, value, units = NA)

Arguments

name
name of the attribute
type
type of data 'string', 'number', 'integer', 'boolean', 'date' or 'base64'
value
value of this attribute
units
The units for value. May be omitted.

Value

an ejAttribute object

Examples

Run this code
characterAttribute <- create_ejAttribute(name="Format name", type="string",
	 value="EpiJSON!")
numericAttribute <- create_ejAttribute(name="Width of building", type="number",
	 value=5.2,"metres")
integerAttribute <- create_ejAttribute(name="Days since last accident", type="integer",
	 value=as.integer(2))
logicalAttribute <- create_ejAttribute(name="Customer satisfied", type="boolean",
	 value=TRUE)
dateAttributeOne <- create_ejAttribute(name="Birthdate", type="date",
	 value=as.Date("1998-08-21"))
dateAttributeTwo <- create_ejAttribute(name="Lunch", type="date",
	 value=as.POSIXct("2015-05-06 12:30"))
if (require(base64enc, quietly=TRUE)){
	binaryAttribute <- create_ejAttribute(name="Lunch", type="base64",
   value=base64encode(as.raw(0:255)))
}

Run the code above in your browser using DataLab