| 1 |
\name{merge.list} |
| 2 |
\alias{merge.list} |
| 3 |
\title{Method for merging two lists by name} |
| 4 |
\description{ |
| 5 |
This is a method that merges the contents of one list |
| 6 |
with another by adding the named elements in the second |
| 7 |
that are not in the first. |
| 8 |
In other words, the first list is the target template, |
| 9 |
and the second one adds any extra elements that it has. |
| 10 |
} |
| 11 |
\usage{ |
| 12 |
merge.list(x, y, ...) |
| 13 |
} |
| 14 |
%- maybe also 'usage' for other objects documented here. |
| 15 |
\arguments{ |
| 16 |
\item{x}{the list to which elements will be added} |
| 17 |
\item{y}{the list which will supply additional elements to \code{x} |
| 18 |
that are not already there by name. } |
| 19 |
\item{\dots}{not used.} |
| 20 |
} |
| 21 |
\value{ |
| 22 |
A named list whose name set is the union of the elements |
| 23 |
in names of x and y and whose values are those taken |
| 24 |
from y and then with those in x, overwriting if necessary. |
| 25 |
} |
| 26 |
\references{Curl homepage \url{https://curl.se/}} |
| 27 |
\author{Duncan Temple Lang} |
| 28 |
|
| 29 |
\seealso{ |
| 30 |
\code{\link[base]{merge}}} |
| 31 |
\examples{ |
| 32 |
\dontrun{ |
| 33 |
# Not exported. |
| 34 |
|
| 35 |
merge.list(list(a=1, b = "xyz", c = function(x, y) {x+y}), |
| 36 |
list(a = 2, z = "a string")) |
| 37 |
|
| 38 |
# No values in y |
| 39 |
merge.list(list(a=1, b = "xyz", c = function(x, y) {x+y}), list()) |
| 40 |
|
| 41 |
# No values in x |
| 42 |
merge.list(list(), list(a=1, b = "xyz", c = function(x, y) {x+y})) |
| 43 |
} |
| 44 |
} |
| 45 |
\keyword{manip} |
| 46 |
|
| 47 |
|