appendNR: Append vectors or lists, without duplcating common elements

View source: R/appendNR.R

appendNRR Documentation

Append vectors or lists, without duplcating common elements

Description

This function allows combining two vectors or lists without duplicating common content (definded by name of list-elements).

Usage

appendNR(x, y, rmDuplicate = TRUE, silent = FALSE, callFrom = NULL)

Arguments

x

(vector or list) must have names to allow checking for duplicate names in y

y

(vector or list) must have names to allow checking for duplicate names in x

rmDuplicate

(logical) avoid duplicating liste-elements present in both x and y (based on names of list-elements)

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of message(s) produced

Details

When setting the argument rmDuplicate=FALSE the function will behave like append.

Value

If both x and y are vectors, the output will be a vector, otherwise it will be a list

See Also

append; lrbind

Examples

li1 <- list(a=1, b=2, c=3)
li2 <- list(A=11, B=12, c=3)
appendNR(li1, li2)
append(li1, li2) 

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