CategoricalValue[cat]
gives the underlying expression associated with a categorical object cat.
CategoricalValue[scale]
gives the expressions associated to the categories of the given categorical scale.
CategoricalValue[obj,prop]
gives the specified property prop for categories or categorical scales.
CategoricalValue
CategoricalValue[cat]
gives the underlying expression associated with a categorical object cat.
CategoricalValue[scale]
gives the expressions associated to the categories of the given categorical scale.
CategoricalValue[obj,prop]
gives the specified property prop for categories or categorical scales.
Details
- CategoricalValue is typically used to get properties from nominal or ordinal categories and their scales, in particular, to extract their underlying expressions.
- The first argument of CategoricalValue can be a Nominal or Ordinal object, both when they represent a single category and a categorical scale. CategoricalValue threads over list inputs.
- Possible properties prop include:
-
"Expression" underlying expression for a category "Category" individual Nominal or Ordinal category "Index" index of a category in the scale "Label" label used for typesetting of a category "Scale" categorical scale "Score" numeric score, used to sort Ordinal categories - CategoricalValue[obj] is equivalent to CategoricalValue[obj,"Expression"].
Examples
open all close allBasic Examples (3)
Convert a Nominal category to its underlying expression:
CategoricalValue[Nominal[Association["CategoryList" -> {"Heads", "Tails"}, "LabelList" -> {"Heads", "Tails"},
"ScoreList" -> {1, 2}], 2]]Convert a list of Nominal categories to their underlying expressions:
RandomChoice[Nominal[{"Heads", "Tails"}], 6]CategoricalValue[%]Get the "Score" value for a list of Ordinal categories:
RandomChoice[Ordinal[{"None", "Light", "Moderate", "High", "Maximum"}], 3]CategoricalValue[%, "Score"]Scope (9)
Category Properties (4)
Get the scale of a nominal category:
Nominal[{"male", "female"}, "male"]CategoricalValue[%, "Scale"]Normalize the scale to its list of categories:
Normal[%]Get the scale of an ordinal category:
CategoricalValue[Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 7], "Scale"]Get the "Label" value for a Ordinal category:
CategoricalValue[Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 7], "Label"]Get the "Index" value for a Nominal category:
CategoricalValue[Nominal[Association["CategoryList" -> {"accrue", "choosy", "spuriously"},
"LabelList" -> {"accrue", "choosy", "spuriously"}, "ScoreList" -> {1, 2, 3}], 2], "Index"]Find the expressions of a list of categories:
CategoricalValue[{Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 3], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 1], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 2], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 5]}, "Expression"]Find the scores of those categories:
CategoricalValue[{Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 3], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 1], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 2], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 5]}, "Score"]Categorical Scale Properties (5)
Get the categories for a nominal scale:
Nominal[{"Heads", "Tails"}]CategoricalValue[%, "Category"]Normalize the categories to their underlying expressions:
Normal[%]Get the categories of an ordinal scale:
CategoricalValue[Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}]], "Category"]Get the "Label" values for a Ordinal scale:
CategoricalValue[Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}]], "Label"]Get the "Index" values for a Nominal scale:
CategoricalValue[Nominal[Association["CategoryList" -> {"accrue", "choosy", "spuriously"},
"LabelList" -> {"accrue", "choosy", "spuriously"}, "ScoreList" -> {1, 2, 3}]], "Index"]Find the list of expressions for a scale:
CategoricalValue[Ordinal[Association["CategoryList" -> {"NS", "S3", "S2", "S1"},
"LabelList" -> {"Not Suitable", "Marginally Suitable", "Moderately Suitable", "Highly Suitable"},
"ScoreList" -> {0, 0.5, 0.75, 1}]], "Expression"]Find the labels for each category in the scale:
CategoricalValue[Ordinal[Association["CategoryList" -> {"NS", "S3", "S2", "S1"},
"LabelList" -> {"Not Suitable", "Marginally Suitable", "Moderately Suitable", "Highly Suitable"},
"ScoreList" -> {0, 0.5, 0.75, 1}]], "Label"]Find the scores for all categories:
CategoricalValue[Ordinal[Association["CategoryList" -> {"NS", "S3", "S2", "S1"},
"LabelList" -> {"Not Suitable", "Marginally Suitable", "Moderately Suitable", "Highly Suitable"},
"ScoreList" -> {0, 0.5, 0.75, 1}]], "Score"]For categorical scale inputs, the "Scale" property returns the input scale:
CategoricalValue[Ordinal[Association["CategoryList" -> {"NS", "S3", "S2", "S1"},
"LabelList" -> {"Not Suitable", "Marginally Suitable", "Moderately Suitable", "Highly Suitable"},
"ScoreList" -> {0, 0.5, 0.75, 1}]], "Scale"]See Also
History
Text
Wolfram Research (2026), CategoricalValue, Wolfram Language function, https://reference.wolfram.com/language/ref/CategoricalValue.html.
CMS
Wolfram Language. 2026. "CategoricalValue." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CategoricalValue.html.
APA
Wolfram Language. (2026). CategoricalValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CategoricalValue.html
BibTeX
@misc{reference.wolfram_2026_categoricalvalue, author="Wolfram Research", title="{CategoricalValue}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/CategoricalValue.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_categoricalvalue, organization={Wolfram Research}, title={CategoricalValue}, year={2026}, url={https://reference.wolfram.com/language/ref/CategoricalValue.html}, note=[Accessed: 12-June-2026]}