conv01toColNa: Convert Matrix Of Integer To Matrix Of x-times Repeated...

View source: R/conv01toColNa.R

conv01toColNaR Documentation

Convert Matrix Of Integer To Matrix Of x-times Repeated Column-Names

Description

conv01toColNa transforms matrix of integers (eg 0 and 1) to repeated & concatenated text from argument colNa, the character string for 0 occurances of argument zeroTex may be customized. Used eg when specifying (and concatenating) various counted elements (eg properties) along a vector like variable peptide modifications in proteomics.

Usage

conv01toColNa(
  mat,
  colNa = NULL,
  zeroTex = "",
  pasteCol = FALSE,
  silent = FALSE,
  debug = FALSE,
  callFrom = NULL
)

Arguments

mat

input matrix (with integer values)

colNa

alternative (column-)names to the ones from 'mat' (default colnames of 'mat')

zeroTex

text to display if 0 (default "")

pasteCol

(logical) allows to collapse all columns to single chain of characters in output

silent

(logical) suppress messages

debug

(logical) display additional messages for debugging

callFrom

(character) allow easier tracking of messages produced

Value

This function returns a character vector

Examples

(ma1 <- matrix(sample(0:3,40,repl=TRUE), ncol=4, dimnames=list(NULL, letters[11:14])))
conv01toColNa(ma1)
conv01toColNa(ma1, colNa=LETTERS[1:4], ze=".")
conv01toColNa(ma1, colNa=LETTERS[1:4], pasteCol=TRUE)

wrMisc documentation built on Nov. 18, 2026, 5:06 p.m.