cbindNR: cbind to non-redundant

View source: R/cbindNR.R

cbindNRR Documentation

cbind to non-redundant

Description

cbindNR combines all matrixes given as arguments to non-redundant column names (by ADDING the number of 'duplicated' columns !). Thus, this function works similar to cbind, but allows combining multiple matrix-objects containing redundant column-names. Of course, all input-matrixes must have the same number of rows ! By default, the output gets sorted by column-names. Note, due to the use of '...' arguments must be given by their full argument-names, lazy evaluation might not recognize properly argument names.

Usage

cbindNR(
  ...,
  convertDFtoMatr = TRUE,
  sortOutput = TRUE,
  summarizeAs = "sum",
  silent = FALSE,
  callFrom = NULL
)

Arguments

...

all matrixes to get combined in cbind way

convertDFtoMatr

(logical) decide if output should be converted to matrix

sortOutput

(logical) optional sorting by column-names

summarizeAs

(character) decide of combined values should get summed (default, 'sum') or averaged ('mean')

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of messages produced

Value

This function returns a matrix or data.frame (as cbind would return)

See Also

cbind, nonAmbiguousNum, firstOfRepLines

Examples

ma1 <- matrix(1:6, ncol=3, dimnames=list(1:2,LETTERS[3:1]))
ma2 <- matrix(11:16, ncol=3, dimnames=list(1:2,LETTERS[3:5]))
cbindNR(ma1, ma2)
cbindNR(ma1, ma2, summarizeAs="mean")

wrMisc documentation built on Nov. 17, 2023, 5:09 p.m.