WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

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
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Category Properties  
Categorical Scale Properties  
See Also
History
Cite this Page

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 all

Basic Examples  (3)

Convert a Nominal category to its underlying expression:

Wolfram Language code: CategoricalValue[Nominal[Association["CategoryList" -> {"Heads", "Tails"}, "LabelList" -> {"Heads", "Tails"}, "ScoreList" -> {1, 2}], 2]]

Convert a list of Nominal categories to their underlying expressions:

Wolfram Language code: RandomChoice[Nominal[{"Heads", "Tails"}], 6]
Wolfram Language code: CategoricalValue[%]

Get the "Score" value for a list of Ordinal categories:

Wolfram Language code: RandomChoice[Ordinal[{"None", "Light", "Moderate", "High", "Maximum"}], 3]
Wolfram Language code: CategoricalValue[%, "Score"]

Scope  (9)

Category Properties  (4)

Get the scale of a nominal category:

Wolfram Language code: Nominal[{"male", "female"}, "male"]
Wolfram Language code: CategoricalValue[%, "Scale"]

Normalize the scale to its list of categories:

Wolfram Language code: Normal[%]

Get the scale of an ordinal category:

Wolfram Language code: 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:

Wolfram Language code: 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:

Wolfram Language code: 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:

Wolfram Language code: 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:

Wolfram Language code: 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:

Wolfram Language code: Nominal[{"Heads", "Tails"}]
Wolfram Language code: CategoricalValue[%, "Category"]

Normalize the categories to their underlying expressions:

Wolfram Language code: Normal[%]

Get the categories of an ordinal scale:

Wolfram Language code: 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:

Wolfram Language code: 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:

Wolfram Language code: CategoricalValue[Nominal[Association["CategoryList" -> {"accrue", "choosy", "spuriously"}, "LabelList" -> {"accrue", "choosy", "spuriously"}, "ScoreList" -> {1, 2, 3}]], "Index"]

Find the list of expressions for a scale:

Wolfram Language code: 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:

Wolfram Language code: 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:

Wolfram Language code: 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:

Wolfram Language code: 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"]
Wolfram Research (2026), CategoricalValue, Wolfram Language function, https://reference.wolfram.com/language/ref/CategoricalValue.html.

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: 20-August-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: 20-August-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /