Analyze Emotions Using NRC Lexicon
analyze_emotions.RdDetects presence of 8 emotions: joy, sadness, anger, fear, anticipation, trust, surprise, disgust. Prints a clean summary to the console and returns results invisibly.
Arguments
- lyrics_obj
Lyrics object from
get_lyrics()- normalize
Logical; normalize counts by total words? Default
TRUE
Value
Invisibly returns a list containing:
emotions - Data frame with emotion counts and percentages
dominant_emotion - Name of the top emotion
summary - One-line text summary
Examples
if (FALSE) { # \dontrun{
lyrics <- get_lyrics("Billie Eilish", "bad guy")
analyze_emotions(lyrics)
# Store result invisibly if needed
result <- analyze_emotions(lyrics)
} # }