vma2char: transforms a vector (or matrix, or array) into a character

Description Usage Arguments Details Value Examples

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

Description

from a vector, or a matrix, or an array, returns a character vector. More or less the inverse function of char2vma.

Usage

1
vma2char(x, xsep=rbsb.sep1)

Arguments

x

The object to transform.

xsep

character(1) to be use for the separations.

Details

When some dimnames exist, the possible missing ones will be added.

Value

a list with two components: [[1]] the coded character vector and [[2]] the type according to char2vma.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 rbsb3k("reset"); # For R checking convenience
 vma2char(letters);
 x <- letters; names(x) <- LETTERS;
 xx <- vma2char(x);
 char2vma(xx[[1]], xx[[2]]);
 vma2char(character(0));
 x <- matrix(1:20, 4);
 vma2char(x);
 dimnames(x) <- list(letters[1:4], LETTERS[1:5]);
 vma2char(x);
 x1 <- matrix(NA, 3, 0);
 xx1 <- vma2char(x1);
 char2vma(xx1[[1]], xx1[[2]]);
 dimnames(x1) <- list(c("i", "ii", "iii"), NULL);
 xx1 <- vma2char(x1);
 char2vma(xx1[[1]], xx1[[2]]);
 x <- array(1:24, 2:4);
 vma2char(x);
 dimnames(x) <- list(1:2, c("i", "ii", "iii"), c("I", "II", "III", "IV"));
 vma2char(x, xsep="|||");
 x0 <- array(NA, c(3, 0, 2));
 dimnames(x0) <- list(1:3, NULL, c("i", "ii"));
 xx0 <- vma2char(x0);
 char2vma(xx0[[1]], xx0[[2]]);

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