weave: Weave elements of two matrices of vectors Weaves two matrices...

Description Usage Arguments Examples

View source: R/weave.R

Description

Weave elements of two matrices of vectors Weaves two matrices or vectors whereby rows (elements) of first matrix (vector) are interspersed with rows (elements) of the second matrix, one by one.

Usage

1
2
weave(a, b, inpar_b = TRUE, rnames = NULL, excl_0 = TRUE,
  within_col = TRUE)

Arguments

a

A vector of matrix. Rows (elements) to be weaved.

b

A vector or matrix. Rows (elements) to weave into a.

inpar_b

Logical. Whether to enclose elements in b with parenthesis.

rnames

A character vector. Names of elements in each row of a (assumed the same in b).

excl_0

Logical. Whether to exclude values of '0' in b.

within_col

Logical. If a and b are vectors, 'TRUE' weaves elements into one column and 'FALSE' returns a in the first row, and b on the second row.

Examples

1
2
3
4
weave(letters[1:5], 1:5, inpar_b = FALSE)
means <- round(runif(3), 3)
sds <- round(runif(10), 3)
weave(means, sds, rnames = c("var1", "var2", "var3"))

clarabicalho/replica documentation built on Nov. 4, 2019, 8:54 a.m.