({{, (RefLink[Merge, paclet:ref/Merge])[{(Subscript[assoc, 1]),(Subscript[assoc, 2]),…},f]
merges the associations (Subscript[assoc, i]), using the function f to combine values with the same key. }, {, (RefLink[Merge, paclet:ref/Merge])[{(Subscript[key, 1])->(Subscript[val, 1]),(Subscript[key, 2])->(Subscript[val, 2]),…},f]
gives an association in which values corresponding to identical keys are combined using f. }, {, (RefLink[Merge, paclet:ref/Merge])[f]
represents an operator form of (RefLink[Merge, paclet:ref/Merge]) that can be applied to an expression.}})

OpenersNotesSection(Spacer1)Details

(RefLink[Merge, paclet:ref/Merge]) can operate on any combination of associations and lists of rules.

In (RefLink[Merge, paclet:ref/Merge])[expr,f], the function f is applied to lists of values that share the same key.

(RefLink[Merge, paclet:ref/Merge])[f][expr] is equivalent to (RefLink[Merge, paclet:ref/Merge])[expr,f].

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Merge two associations, using (RefLink[Total, paclet:ref/Total]) to combine elements with the same key:

Merge[{<|a->1,b->2|>,<|a->5,b->10|>},Total]

Combine values corresponding to identical keys into lists:

Merge[{<|a->1,b->2|>,<|b->4,c->5|>},Identity]

Combine rules with the same left-hand side:

Merge[{a->x,a->y,b->z},f]

Create a (RefLink[Merge, paclet:ref/Merge]) operator:

merge=Merge[Total];

merge[{<|a->1,b->2|>,<|a->3,b->1|>}]

OpenersExampleSection1(Spacer1)Scope  (1)

Combine mixed list entries:

Merge[{<|a->x|>,a->y,{b->z}},Identity]

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

Using a combiner function is equivalent to using (RefLink[Map, paclet:ref/Map]):

Merge[{<|a->1|>,<|a->2,d->1|>},Total]

Map[Total,Merge[{<|a->1|>,<|a->2,d->1|>},Identity]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[GroupBy, paclet:ref/GroupBy])  ▪  (RefLink[KeyIntersection, paclet:ref/KeyIntersection])  ▪  (RefLink[KeyUnion, paclet:ref/KeyUnion])  ▪  (RefLink[Counts, paclet:ref/Counts])  ▪  (RefLink[CountsBy, paclet:ref/CountsBy])  ▪  (RefLink[Transpose, paclet:ref/Transpose])  ▪  (RefLink[GatherBy, paclet:ref/GatherBy])  ▪  (RefLink[JoinAcross, paclet:ref/JoinAcross])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Computation with Structured Datasets, paclet:guide/ComputationWithStructuredDatasets])}, {▪(RefLinkPlain[Associations, paclet:guide/Associations])}, {▪(RefLinkPlain[Database-Like Operations on Datasets, paclet:guide/DatabaseLikeOperationsOnDatasets])}, {▪(RefLinkPlain[Language Overview, paclet:guide/LanguageOverview])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/34-associations.html])(WebLink[: Associations, https://www.wolfram.com/language/elementary-introduction/34-associations.html])}})}})