Learn R Programming

ifultools (version 2.0-26)

mergeList: Merges the information from two lists

Description

Given lists X and Y, this functions replaces the commonly named objects in X with those of Y and appends the uncommon Y components to X. List X is returned as the merged list.

Usage

mergeList(x, y)

Arguments

x

a list of named objects.

y

a list of named objects.

See Also

prettyPrintList.

Examples

Run this code
## develop lists 
dinner <- list(Entree="Spaghetti and Meatballs",
    Starter="Caesar Salad", Dessert="Spumoni",
    Beverage="Wine and Water")

## oops, we are all out of spumoni and we just got 
## some tiramisu in from the local bakery 
change <- list(Dessert="Tiramisu",Note="Please tip your waiter")

## merge the lists and prett-print 
prettyPrintList(mergeList(dinner, change), header="What's for dinner?")

Run the code above in your browser using DataLab