plot_bigfive
creates a radar plot visualising the average scores of the Big Five
personality traits, supporting both individual and group comparisons. It optionally
accommodates weighted data.
Usage
plot_bigfive(
data,
bigfive,
group = NULL,
weight = NULL,
totalColour = colour_pal("Regent Grey"),
groupColours = colour_pal("catExtended")
)
Arguments
- data
A data frame containing survey data with Big Five personality trait scores.
- bigfive
A vector of column names representing the Big Five personality traits. Each trait's scores should be numeric and range from 0 to 100.
- group
An optional variable for comparing trait scores between different groups.
- weight
An optional variable containing weight factors for the analysis.
- totalColour
The colour used for plotting total average scores (default is a grey color).
- groupColours
A vector of coluors used for plotting grouped average scores (default uses a predefined palette).
Value
A ggplot2 radar plot visualising the average scores of the Big Five personality traits. The plot includes comparisons for total and, if specified, grouped averages.
Details
The function performs checks to ensure that the specified bigfive
variables exist in
data
and are numeric within the range of 0 to 100. It then calculates average scores
(weighted or unweighted) and creates a radar plot for visual comparison. The plot
includes both individual trait scores and, if a group
variable is provided, scores
by group.
Examples
if (FALSE) { # \dontrun{
# Example: Create a radar plot for Big Five traits, grouped by age categories
plot_bigfive(dataset,
bigfive = c("Neuroticism", "Extroversion", "Openness",
"Agreeableness", "Conscientiousness"),
group = "age_categories",
weight = "wgtvar")
} # }