Learn R Programming

rAmCharts (version 1.1.1)

initialize,DataSet-method: Initialize a DataSet

Description

Initialize a DataSet

Usage

## S3 method for class 'DataSet':
initialize(.Object, compared = FALSE, dataProvider,
  fieldMappings, stockEvents, ...)

dataSet(compared = FALSE, dataProvider, fieldMappings, stockEvents, ...)

## S3 method for class 'DataSet,data.frame': setDataProvider(.Object, dataProvider, keepNA = TRUE)

setFieldMappings(.Object, fieldMappings)

## S3 method for class 'DataSet,list': setFieldMappings(.Object, fieldMappings)

addFieldMapping(.Object, ...)

## S3 method for class 'DataSet': addFieldMapping(.Object, ...)

setStockEvents(.Object, stockEvents)

## S3 method for class 'DataSet,list': setStockEvents(.Object, stockEvents)

addStockEvent(.Object, stockEvent = NULL, ...)

## S3 method for class 'DataSet': addStockEvent(.Object, stockEvent = NULL, ...)

Arguments

.Object
DataSet.
compared
logical.
dataProvider
data.frame. The data set data. Important: the data sets need to come pre-ordered in ascending order. Data with incorrect order might result in visual and functional glitches on the chart.
fieldMappings
list of field mappings. Field mapping is an object with fromField and toField properties. fromField is a name of your value field in dataProvider. toField might be chosen freely, it will be used to set value/open/close/high/low fields for the
stockEvents
StockEvent.
...
Other properties.
keepNA
logical. Should the missing values appear in the list ?
stockEvent
StockEvent.

Value

  • (updated) DataSet object

Examples

Run this code
new("DataSet")
dataSet(categoryField = "categoryField")
setDataProvider(.Object = dataSet(), data.frame(key = c("FR", "US"), value = c(20,10)))
addFieldMapping(.Object = dataSet(), fieldMappings = list(fromField ="val1", toField ="value"))
addFieldMapping(.Object = dataSet(), fromField ="val1", toField ="value")

Run the code above in your browser using DataLab