Learn R Programming

mtconnectR (version 0.2.0)

add_data_item_to_mtc_device: Add a new data item to an existing MTC Device Class

Description

Add a new data item to an existing MTC Device Class

Usage

add_data_item_to_mtc_device(mtc_device, data_item_data, data_item_name,
  data_item_type = "Event", source_type = "derived", xmlID = "")

Arguments

mtc_device
An existing object of MTCDevice Class
data_item_data
data for the new data item to add
data_item_name
Name of the new data Item
data_item_type
Type of the new data item. Can be Event or Sample
source_type
source from where data is derived. Free form text
xmlID
id of the data item (optional)

Examples

Run this code
data_item_data = data.frame(timestamp = as.POSIXct(c(0.5, 1, 1.008, 1.011) +
                                        1445579573,  tz = 'CST6CDT', origin = "1970-01-01"),
                            value = c("a", "b", "c", "d"))
data("example_mtc_device")
mtc_device_updated = 
   add_data_item_to_mtc_device(example_mtc_device, data_item_data, data_item_name = "test",
                               data_item_type = "Event", source_type = "derived")
print(mtc_device_updated)

Run the code above in your browser using DataLab