top of page



What Is Emodiversity?

Emodiversity measures the variety and relative abundance of emotions a person experiences.


High emodiversity means experiencing many different emotions in relatively balanced proportions, while low emodiversity means experiencing only a few distinct emotions in unbalanced proportions.

Here, Person A and Person B have the same average levels of positive emotion (4.2 / 10). However, Person A's emotional life is almost 50% more diverse than Person B's.  


On this page, you'll find an easy-to-use R function to compute emodiversity from any emotion scale.

R Function to Compute Emodiversity

Description: The compute_emodiversity function for R computes emodiversity (Shanon's entropy) for each participant in a dataset.

It accommodates any number of emotion items and supports different rating scales, whether you coded emotion from 1 to 7, 0 to 100, or any other scale.

The function also handles single (one-shot survey) or multiple time points (e.g., ESM or diary data) and missing values.  


  • df: The input dataframe.

  • emotion_cols: A vector of column names representing emotion ratings.

  • id_col: The column name representing participant IDs.

  • multiple_times: Boolean indicating if each participant provides multiple sets of emotion ratings (e.g., an experience sampling or diary study in which emotions are measured on multiple occasions). The default is FALSE.

  • absence_code: The value used to code the absence of emotion. By default, the function assumes "not experiencing an emotion" is coded as 0. If you use a 1 (not at all) to 7 (extremely) Likert scale, for example, then specify absence_code = 1.


  • If `absence_code` is `1`, the function will recode the emotion ratings to start from 0.

  • Missing values are replaced with 0 (no emotion).

  • If `multiple_times` is `TRUE`, emotion ratings are averaged for each participant.

  • Emodiversity is calculated using the `diverse` package.

  • Emodiversity is expressed both as a raw score (Shanon's entropy) and as a percentage of the maximum possible emodiversity given the number of items on your emotion scale.

  • The computed emodiversity scores are merged back into the original dataframe.


Return Value:

A dataframe with added columns for emodiversity, emodiversity percentage, and the number of measurement occasions per participant.


R Code:

Usage Example Code:

Let's create a toy dataframe where 10 participants rated whether they were experiencing 4 distinct emotions on a scale from 1 (not at all) to 7 (extremely) on three separate occasions. Then let's run the compute_emodiversity function. 

bottom of page