mergeSelCol: Merge selected columns out of 2 matrix or data.frames

View source: R/mergeSelCol.R

mergeSelColR Documentation

Merge selected columns out of 2 matrix or data.frames

Description

This function merges selected columns out of 2 matrix or data.frames. 'selCols' will be used to define columns to be used; optionally may be different for 'dat2' : define in 'supCols2'. Output-cols will get additions specified in newSuff (default '.x' and '.y')

Usage

mergeSelCol(
  dat1,
  dat2,
  selCols,
  supCols2 = NULL,
  byC = NULL,
  useAll = FALSE,
  setRownames = TRUE,
  newSuff = c(".x", ".y"),
  silent = FALSE,
  debug = FALSE,
  callFrom = NULL
)

Arguments

dat1

matrix or data.frame for fusing

dat2

matrix or data.frame for fusing

selCols

will be used to define columns to be used; optionally may be different for 'dat2' : define in 'supCols2'

supCols2

if additional column-names should be extracted form dat2

byC

(character) 'by' value used in merge

useAll

(logical) use all lines (will produce NAs when given identifyer not found un 2nd group of data)

setRownames

(logical) if TRUE, will use values of col used as 'by' as rownames instead of showing as add'l col in output

newSuff

(character) prefix (argument 'suffixes' in merge)

silent

(logical) suppress messages

debug

(logical) display additional messages for debugging

callFrom

(character) allow easier tracking of messages produced

Value

This function returns a data.frame containing the merged columns

See Also

merge, merge 3 data.frames using mergeSelCol3

Examples

mat1 <- matrix(c(1:7,letters[1:7],11:17), ncol=3, dimnames=list(LETTERS[1:7],c("x1","x2","x3")))
mat2 <- matrix(c(1:6,c("b","a","e","f","g","k"), 31:36),
  ncol=3, dimnames=list(LETTERS[11:16],c("y1","x2","x3")))
mergeSelCol(mat1, mat2, selC=c("x2","x3"))

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