Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mergeVectors

Merge Named Vectors


Description

This function allows merging for multiple simple named vectors (each element needs to be named). Basically, all elements carrying the same name across different input-vectors will be ailgned in the same coumn of the output (input-vectors appear as lines). If vectors are not given using a name (see first example below), they will be names 'x.1' etc (see argument namePrefix). Note : The arguments 'namePrefix', 'callFrom' and 'silent' must be given with full name to be recognized as such (and not get considered as vector for merging).

Usage

mergeVectors(..., namePrefix = "x.", callFrom = NULL, silent = FALSE)

Arguments

...

all vectors that need to be merged

namePrefix

(character) prefix to numers used when vectors are not given with explicit names (second exammple)

callFrom

(character) allow easier tracking of message produced

silent

(logical) suppres messages

Value

matrix of merged values

See Also

merge (for two data.frames)

Examples

x1 <- c(a=1, b=11, c=21)
x2 <- c(b=12, c=22, a=2)
x3 <- c(a=3, d=43)
mergeVectors(vect1=x1, vect2=x2, vect3=x3)
x4 <- 41:44     # no names - not conform for merging
mergeVectors(x1,x2,x3,x4)

wrMisc

Analyze Experimental High-Throughput (Omics) Data

v1.5.4
GPL-3
Authors
Wolfgang Raffelsberger [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.