CountsBy

CountsBy[{e1,e2,},f]

gives an association whose keys are the distinct values of the f[ei], and whose values give the number of times these f[ei] values appear.

CountsBy[f]

represents an operator form of CountsBy that can be applied to an expression.

Details

  • CountsBy[{e1,e2,},f] gives an association whose keys f[ei] are in the order in which the corresponding ei first appear.
  • CountsBy[f][expr] is equivalent to CountsBy[expr,f].

Examples

open allclose all

Basic Examples  (2)

Use the operator form of CountsBy:

Properties & Relations  (1)

The result of CountsBy is identical to that of Counts applied to the results of Map:

Wolfram Research (2014), CountsBy, Wolfram Language function, https://reference.wolfram.com/language/ref/CountsBy.html.

Text

Wolfram Research (2014), CountsBy, Wolfram Language function, https://reference.wolfram.com/language/ref/CountsBy.html.

CMS

Wolfram Language. 2014. "CountsBy." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CountsBy.html.

APA

Wolfram Language. (2014). CountsBy. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CountsBy.html

BibTeX

@misc{reference.wolfram_2024_countsby, author="Wolfram Research", title="{CountsBy}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/CountsBy.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_countsby, organization={Wolfram Research}, title={CountsBy}, year={2014}, url={https://reference.wolfram.com/language/ref/CountsBy.html}, note=[Accessed: 22-November-2024 ]}