Learn R Programming

DEXiR (version 1.0.2)

dexi_value: dexi_value

Description

Conversion of a string to a "DEXi value" (see DEXiR-package) according to "new" DEXi syntax rules. In .dxi files, this syntax is used in ALTERNATIVE and RULE XML tags. Examples of possible options include:


 x                              result
 ------------------------------+-------------------------------------------------
 NULL or ""                     NULL
 "*"                            "*"
 a string starting with "undef" NA
 "2"                            a single ordinal value, c(2) in this case
 "2.1"                          a single number, c(2.1) in this case
 "1:3"                          interval, equivalent to c(1, 2, 3)
 "{0;2;3}"                      a value set, equivalent to c(0, 2, 3)
 "<0;0.3;0.7>"                  a value distribution, distribution(0.0, 0.3, 0.7)

Usage

dexi_value(x, add = 0)

Value

A single integer or real number, an integer numeric vector, or a distribution.

Arguments

x

character(1).

add

A numeric constant to be added to the result. Useful when converting DEXi's zero-based representation to one-based representation used in R, which requires the setting add = 1.

See Also

DEXiR-package, dexi_option_value(), distribution

Examples

Run this code
dexi_value("")
dexi_value(NULL)
dexi_value("*")
dexi_value("UNDEF")
dexi_value("2")
dexi_value("2.1")
dexi_value("1:3")
dexi_value("{0;2;3}")
dexi_value("{0;2;3}", add = 1)
dexi_value("<0;0.3;0.7>")

Run the code above in your browser using DataLab