DataSet: Creates or updates a DataSet

Description Usage Arguments Value Examples

Description

Uses the constructors to create the object with its properties or updates an existing one with the setters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## S4 method for signature 'DataSet'
initialize(
  .Object,
  compared = FALSE,
  dataProvider,
  fieldMappings,
  stockEvents,
  ...
)

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

## S4 method for signature 'DataSet,ANY,ANY'
setDataProvider(.Object, dataProvider, keepNA = TRUE)

setFieldMappings(.Object, fieldMappings)

## S4 method for signature 'DataSet,list'
setFieldMappings(.Object, fieldMappings)

addFieldMapping(.Object, ...)

## S4 method for signature 'DataSet'
addFieldMapping(.Object, ...)

setStockEvents(.Object, stockEvents)

## S4 method for signature 'DataSet,list'
setStockEvents(.Object, stockEvents)

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

## S4 method for signature 'DataSet,StockEventOrMissing'
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 StockGraph. Example: list(fromField = "val1", toField ="value").

stockEvents

StockEvent.

...

other properties of DataSet.

keepNA

logical, TRUE to keep NA values.

stockEvent

StockEvent. Argument for method addStockEvent.

Value

(updated) DataSet object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
new("DataSet")

dataSet(categoryField = "categoryField")

setDataProvider(.Object = dataSet(), data.frame(key = c("FR", "US"), value = c(20,10)))

dataset <- addFieldMapping(.Object = dataSet(),
                           fieldMappings = list(fromField ="val1", toField ="value"))
print(dataset)
dataset <- addFieldMapping(.Object = dataSet(), fromField ="val1", toField ="value")
print(dataset)
addStockEvent(.Object = dataSet(), backgroundAlpha = 1, backgroundColor = "#DADADA")
# equivalent to:
stockEvent_obj <- stockEvent(backgroundAlpha = 1, backgroundColor = "#DADADA")
chart <- addStockEvent(.Object = dataSet(), stockEvent = stockEvent_obj); print(chart)

rAmCharts documentation built on Dec. 6, 2019, 5:11 p.m.

Related to DataSet in rAmCharts...