Learn R Programming

nomiShape (version 1.0.0)

central_concentration: Central Concentration Index for Nominal Variables

Description

Computes a measure of how concentrated counts are around the center of a nominal variable, based on the centered plotting order.

Usage

central_concentration(df, var, top_k = 3, weighted = FALSE)

Value

A numeric value between 0 and 1 representing the central concentration.

Arguments

df

A data.frame or tibble containing the variable.

var

Character. Name of the nominal variable in df.

top_k

Numeric. Number of central categories to consider (default: 3).

weighted

Logical. If TRUE, applies a weight decreasing with distance from center.

Examples

Run this code
central_concentration(categories, "animal")
central_concentration(categories2, "animal", top_k = 5)
central_concentration(categories3, "animal", weighted = TRUE)

Run the code above in your browser using DataLab