nv2ion: returns the /ion/ of a series of nodes/variables

Description Usage Arguments Details Value Examples

View source: R/f1.rbsb2.code.r

Description

(ba) This is a central, basic and very general function for programming with /rebastaba/, so not that easy to grasp. It is suggested to read the detail section.
From a series of nodes (or variables) indicated with 'x' returns their complete name/index descriptions under a 'ion' object. Checking can be desactivated, anyway it is of course conditional to rbsb.mck...
Be aware that the proposed order is not respected, nodes/variables are sorted!

Usage

1
nv2ion(x, nom, kwhat="n", check=TRUE)

Arguments

x

indicates one or several subsets of nodes/variables of the second argument (nom). When they are several subsets, nv2ion deals with the union of them. The indication can be made (1) by names (character interpreted of nodes or variates according to the third argument kwhat; (ii) a numeric matrix of two rows giving its columns the [node number, variable number]; (iii) a numeric giving the index of nodes or variables according to the third argument kwhat.
See the description section for more insights.
Additional facilities are given by the extensions of '-' (when x is a character), 0 and -1 (when x is numeric). "-", matrix(c(0,-1),2) and 0 are equivalent. Notice that matrix(c(0,0),2) will keep on the developped set of variable names (not using '-').

nom

nom object of reference.

kwhat

This argument is used in two different ways according its values. When 'x' is a single numeric it indicates if the user wants to specify a node ("n"/"N") or a variable ("v"). But when it is a node (either numeric or character), it indicates if the node is wanted ("n") of the set of variables of this n

check

( when TRUE checking of the argument consistence is performed if rbsb.mck is also TRUE.

Details

There are different ways to designate a subset of nodes/variables belonging to a /nom/ object. Let A[a], A[b], A[c], B, C[1], C[2] be the set of variables of /nom/ uu given in the example section. Intuitively, we coud designate the first node in different ways: (1) as the first node, (2) as the node of name 'A', (3) as the first three variables of uu, (4) as the subset of variables 'A[a]', 'A[b]' and 'A[c]'... nv2ion using one of these ways (and more) returns equivalent ways of defining them.
Said in a different manner, it gives the simultaneous translation of one way in every known ways. This could be quite useful for exchanges between user and algorithms. Another properties is to give the subsets in a unique way.
In fact "-" is rbsb.all.

Value

A 'ion' object comprising names, indices and identifications.

@nn

The node names.

@vn

The variable names.

@nvn

The node[variable] names.

@ij

The variable indices within each node.

@nk

The indices at the node level.

@vk

The indices at the variable level.

@iden

The identification of the x inputs by a character vector of the same length and containing either 'nn' (-> node as node), or 'nv' (-> node as variable set), or 'v' (-> variable level).

Examples

1
2
3
4
5
6
7
8
9
 rbsb3k("RESET"); # needed only for R checking, to be forgotten
 nv2ion(1, rbsb.nom2, "n");
 nv2ion(1, rbsb.nom2, "N");
 nv2ion(1, rbsb.nom2, "v");
 nv2ion(0, rbsb.nom2, "n");
 nv2ion("-", rbsb.nom2, "n");
 nv2ion("A", rbsb.nom2, "n");
 nv2ion("B", rbsb.nom2, "n");
 nv2ion("C", rbsb.nom3, "n");

rbsb documentation built on May 31, 2017, 1:45 a.m.