Calculate Positive/Negative Ratio
positive_negative_ratio.RdComputes the balance between positive and negative sentiment lines. Prints a clean summary to the console and returns results invisibly.
Arguments
- lyrics_obj
Lyrics object from
get_lyrics()
Value
Invisibly returns a list containing:
ratio - Positive to negative ratio (Inf if no negative lines)
ratio_text - Human-readable ratio string
interpretation - Text description of balance
positive_lines - Count of positive lines
negative_lines - Count of negative lines
neutral_lines - Count of neutral lines
positive_percentage - Percentage of positive lines
negative_percentage - Percentage of negative lines
neutral_percentage - Percentage of neutral lines
Examples
if (FALSE) { # \dontrun{
lyrics <- get_lyrics("Pharrell Williams", "Happy")
positive_negative_ratio(lyrics)
} # }