Showcase Dashboard
  • Home
  • GSS Data Analysis
  • Key Findings
  • Summary Charts
  • About

Key Findings

Our analysis reveals a clear relationship between education and happiness levels. Higher education is generally associated with greater reported happiness. Political trust varies significantly across party lines and ideological positions, with interesting regional and demographic patterns.

Next Steps

Future research should explore the causal mechanisms behind these relationships.

Demographics & Education

  • Happiness Distribution Across Education Levels
  • Happiness Distribution by Gender

How happy are you with your life right now?

How happy are you with your life right now?

Political Attitudes

  • Party ID by Political Views
  • Trust Levels by US Region
  • Gender Distribution Across Social Classes

This shows how party identification aligns with political ideology.

Do you think you can usually trust strangers?

Gender distribution across different social class categories.

Social Issues

  • Trust by Education and Age
  • Trust by Region and Education

This heatmap reveals trust patterns across education and age groups.

Educational and regional patterns in trust distribution.

Back to top
Source Code
---
title: "{{< iconify ph lightbulb >}} Key Findings"
format: html
---

Our analysis reveals a clear relationship between education and happiness levels. Higher education is generally associated with greater reported happiness. Political trust varies significantly across party lines and ideological positions, with interesting regional and demographic patterns.

## Next Steps

Future research should explore the causal mechanisms behind these relationships.

```{r setup}
#| echo: false
#| warning: false
#| message: false
#| error: false
#| results: 'hide'

# Load required libraries
library(dashboardr)
library(dplyr)
library(highcharter)

# Global chunk options
knitr::opts_chunk$set(
  echo = FALSE,
  warning = FALSE,
  message = FALSE,
  error = FALSE,
  fig.width = 12,
  fig.height = 8,
  dpi = 300
)

# Load data from dataset_2867obs.rds
data <- readRDS('dataset_2867obs.rds')

# Data summary
cat('Dataset loaded:', nrow(data), 'rows,', ncol(data), 'columns\n')

```

## Demographics & Education


::: {.panel-tabset}

### {{< iconify ph chart-bar >}} Happiness Distribution Across Education Levels


How happy are you with your life right now?

```{r demographics-3}
# Happiness Distribution Across Education Levels
result <- create_stackedbar(
  data = data,
  title = "Happiness Distribution Across Education Levels",
  x_var = "degree_1a",
  stack_var = "happy_1a",
  subtitle = "Percentage breakdown within each education category",
  x_label = "Education Level",
  y_label = "Percentage of Respondents",
  stack_label = "Happiness Level",
  stacked_type = "percent",
  x_order = c("Lt High School", "High School", "Junior College", "Bachelor", "Graduate"),
  stack_order = c("Very Happy", "Pretty Happy", "Not Too Happy"),
  tooltip_suffix = "%",
  color_palette = c("#2E86AB", "#A23B72", "#F18F01")
)

# Apply height to highcharter object
if (inherits(result, 'highchart')) {
  result <- highcharter::hc_chart(result, height = 500)
}

result
```


### {{< iconify ph gender-intersex >}} Happiness Distribution by Gender

```{r demographics-4}
# Happiness Distribution by Gender
result <- create_stackedbar(
  data = data,
  title = "Happiness Distribution by Gender",
  x_var = "sex_1a",
  stack_var = "happy_1a",
  subtitle = "Gender differences in reported happiness levels",
  x_label = "Gender",
  y_label = "Percentage of Respondents",
  stack_label = "Happiness Level",
  stacked_type = "percent",
  stack_order = c("Very Happy", "Pretty Happy", "Not Too Happy"),
  tooltip_suffix = "%",
  color_palette = c("#2E86AB", "#A23B72", "#F18F01")
)

# Apply height to highcharter object
if (inherits(result, 'highchart')) {
  result <- highcharter::hc_chart(result, height = 450)
}

result
```

How happy are you with your life right now?



:::

## Political Attitudes


::: {.panel-tabset}

### {{< iconify ph users-three >}} Party ID by Political Views


This shows how party identification aligns with political ideology.

```{r politics-4}
# Party ID by Political Views
result <- create_stackedbar(
  data = data,
  title = "Party ID by Political Views",
  x_var = "polviews_1a",
  stack_var = "partyid_1a",
  subtitle = "Distribution of party identification across political ideology",
  x_label = "Political Views",
  y_label = "Percentage of Respondents",
  stack_label = "Party ID",
  stacked_type = "percent",
  tooltip_suffix = "%",
  color_palette = c("#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2")
)

# Apply height to highcharter object
if (inherits(result, 'highchart')) {
  result <- highcharter::hc_chart(result, height = 550)
}

result
```


### {{< iconify ph map-pin >}} Trust Levels by US Region

```{r politics-5}
# Trust Levels by US Region
result <- create_stackedbar(
  data = data,
  title = "Trust Levels by US Region",
  x_var = "region_1a",
  stack_var = "trust_1a",
  subtitle = "Regional variation in interpersonal trust",
  x_label = "US Region",
  y_label = "Percentage of Respondents",
  stack_label = "Trust Level",
  stack_order = c("Can Trust", "Can't Be Too Careful", "Depends"),
  stacked_type = "percent",
  tooltip_suffix = "%",
  color_palette = c("#2E8B57", "#DAA520", "#CD5C5C")
)

# Apply height to highcharter object
if (inherits(result, 'highchart')) {
  result <- highcharter::hc_chart(result, height = 500)
}

result
```

Do you think you can usually trust strangers?



### {{< iconify ph chart-pie >}} Gender Distribution Across Social Classes


Gender distribution across different social class categories.

```{r politics-6}
# Gender Distribution Across Social Classes
result <- create_stackedbar(
  data = data,
  title = "Gender Distribution Across Social Classes",
  x_var = "class_1a",
  stack_var = "sex_1a",
  subtitle = "With custom labels and ordering",
  x_label = "Self-Reported Social Class",
  y_label = "Number of Respondents",
  stack_label = "Gender",
  x_order = c("Lower Class", "Working Class", "Middle Class", "Upper Class"),
  stack_order = c("Female", "Male"),
  stacked_type = "counts",
  tooltip_prefix = "Count: ",
  color_palette = c("#E07A5F", "#3D5A80")
)

# Apply height to highcharter object
if (inherits(result, 'highchart')) {
  result <- highcharter::hc_chart(result, height = 450)
}

result
```


:::

## Social Issues


::: {.panel-tabset}

### {{< iconify ph heatmap >}} Trust by Education and Age

```{r social-3}
# Trust by Education and Age
result <- create_heatmap(
  data = data,
  title = "Trust by Education and Age",
  x_var = "degree_1a",
  y_var = "age_1a",
  value_var = "trust_1a",
  subtitle = "Average trust levels across education and age groups",
  x_label = "Education Level",
  y_label = "Age Group",
  value_label = "Trust Level",
  x_order = c("Lt High School", "High School", "Junior College", "Bachelor", "Graduate"),
  color_palette = c("#d7191c", "#fdae61", "#ffffbf", "#abdda4", "#2b83ba"),
  tooltip_prefix = "Trust: ",
  tooltip_suffix = "/3",
  tooltip_labels_format = "{point.value:.2f}"
)

# Apply height to highcharter object
if (inherits(result, 'highchart')) {
  result <- highcharter::hc_chart(result, height = 600)
}

result
```

This heatmap reveals trust patterns across education and age groups.



### {{< iconify ph chart-pie >}} Trust by Region and Education


Educational and regional patterns in trust distribution.

```{r social-4}
# Trust by Region and Education
result <- create_heatmap(
  data = data,
  title = "Trust by Region and Education",
  x_var = "region_1a",
  y_var = "degree_1a",
  value_var = "trust_1a",
  subtitle = "Educational and regional patterns in trust levels",
  x_label = "Region",
  y_label = "Education Level",
  value_label = "Trust Level",
  y_order = c("Lt High School", "High School", "Junior College", "Bachelor", "Graduate"),
  color_palette = c("#d7191c", "#fdae61", "#ffffbf", "#abdda4", "#2b83ba"),
  tooltip_prefix = "Trust: ",
  tooltip_suffix = "/3",
  tooltip_labels_format = "{point.value:.2f}"
)

# Apply height to highcharter object
if (inherits(result, 'highchart')) {
  result <- highcharter::hc_chart(result, height = 550)
}

result
```


:::
 

© 2025 dashboardr Package - All Rights Reserved

  • Edit this page
  • View source
  • Report an issue