Learn R Programming

mtconnectR (version 0.2.0)

extract_param_from_xpath: Extract different parts of a xpath

Description

Returns a single parameter extracted from the xpath vector. It could be Data Item Name Data Item type of the Device. If the character vector is not in xpath format, the original name is returned and a warning is given

Usage

extract_param_from_xpath(strName, param = "DIName", removeExtended = F,
  show_warnings = T)

Arguments

strName
is the xpath string
param
is the parameter to be extracted. Can be "DIName", "DIType" or "Device"
removeExtended
if True, then the x: prefix is removed from extended JSON class Types
show_warnings
if false, silences the warnings

Examples

Run this code
xpaths = c("timestamp", 
 "nist_testbed_Mazak_QT_1<Device>:avail<AVAILABILITY>",
 "nist_testbed_Mazak_QT_1<Device>:execution<EXECUTION>",
 "nist_testbed_Mazak_QT_1<Device>:Fovr<x:PATH_FEEDRATE-OVERRIDE>")
 
extract_param_from_xpath(xpaths, "DIName")
extract_param_from_xpath(xpaths, "DIType")
extract_param_from_xpath(xpaths, "DIType", TRUE)
extract_param_from_xpath(xpaths, "Device")

Run the code above in your browser using DataLab