Description Usage Arguments Details Value Examples
(text2vma)
from a character vector, returns a vector, or a matrix, or
an array of _characters_ with possibly names, or dimames. The information
can be supplied in different ways for each of the three possibilities.
It is advised to try the proposed examples.
(vma2text)
from a vector, or a matrix, or
an array, builds a character vector. More or less the
inverse function of text2vma. This vector is the first
component of a returned list, the second component of the list
gives the type (vector, matrix or array) of x,
the converted object.
1 2 3 4 5 6 |
cha |
The character to transform. |
x |
The object to transform. |
what |
Indicates which structure to return: either a vector, a matrix or an array. |
xsep |
Character sequence used to separate the character vector into blocks giving information about the structure (see the examples). |
nat |
Nature of the returned structure. Can be C for character, N for numeric or L for logical. |
monitor |
List of constants indicating the monitoring choices, see the rbsa0$monitor$v provided object as an example. |
(text2vma)
The processing is done in character mode but the result can be
transformed into numerical or logical values with the help of argument nat.
In fact rbsa0$vma$v coding is used for the argument what.
This allows to easily modify the coding.
(vma2text)
When some dimnames exist, the possible missing
ones will be added.
(text2vma)
a vector or a matrix or an array according to the arguments.
(vma2text)
a list with two components: [[1]] the coded character vector and
[[2]] the type according to text2vma.
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
##
## text2vma
####
# vectors
text2vma(letters,"c");
text2vma(letters,"C",xsep="e");
text2vma(letters);
text2vma(letters,"V");
text2vma(letters,"u");
text2vma(c(LETTERS,letters),rbsa0$vma$v["V"]);
text2vma(c("A","a","B","b","C","c"),rbsa0$vma$v["U"]);
####
# matrices
text2vma(c(1:3,"//",4:6),rbsa0$vma$v["m"]);
text2vma(c(1:3,"//",4:6),rbsa0$vma$v["M"]);
text2vma(c(LETTERS[1:3],"//",1:3,"//",4:6),rbsa0$vma$v["n"]);
text2vma(c(LETTERS[1:3],"//",1:3,"//",4:6),"N");
text2vma(c("a",1:3,"//","b",4:6),"o");
text2vma(c(c(LETTERS[1:3],"//","a",1:3,"//","b",4:6)),rbsa0$vma$v["p"]);
####
# arrays
text2vma(c(2:4,"//",1:24),"a");
text2vma(c(2:4,"//","one","two","//",LETTERS[1:3],"//",
letters[1:4],"//",1:24),"A");
text2vma(c(2:4,"//","one","two","//",LETTERS[1:3],"//",
letters[1:4],"//",1:24),"A",nat="N");
##
## vma2text
####
# vectors
vma2text(letters);
x <- letters; names(x) <- LETTERS;
xx <- vma2text(x);
text2vma(xx[[1]],xx[[2]]);
vma2text(character(0));
####
# matrices
x <- matrix(1:20,4);
vma2text(x);
dimnames(x) <- list(letters[1:4],LETTERS[1:5]);
vma2text(x);
x1 <- matrix(NA,3,0);
xx1 <- vma2text(x1);
text2vma(xx1[[1]],xx1[[2]]);
dimnames(x1) <- list(c("i","ii","iii"),NULL);
xx1 <- vma2text(x1);
text2vma(xx1[[1]],xx1[[2]]);
####
# arrays
x <- array(1:24,2:4);
vma2text(x);
dimnames(x) <- list(1:2,c("i","ii","iii"),c("I","II","III","IV"));
vma2text(x,xsep="|||");
x0 <- array(NA,c(3,0,2));
dimnames(x0) <- list(1:3,NULL,c("i","ii"));
xx0 <- vma2text(x0);
text2vma(xx0[[1]],xx0[[2]]);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.