Column

Relationship Between Final grade and Gender

Column

Overview of Time Spent on Different Subjects

Relationship Between Time Spent and Interest

---
title: "This is an example of a Flexdashboard that you can create for your stakeholders"
output:
  flexdashboard::flex_dashboard:
    theme: 
      version: 4
      bootswatch: pulse
    source_code: embed
  html_document:
    df_print: paged
editor_options: 
  chunk_output_type: console
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(here)


data_to_viz <- read_csv(here("part3-dataviz-quarto", "data", "data_to_explore.csv")) 

data_to_viz <- data_to_viz |>
  mutate(final_grade = proportion_earned*100)|>
  mutate(subject = recode(subject, 
                          "AnPhA" = "Anatomy",
                          "BioA" = "Biology", 
                          "FrScA" = "Forensics", 
                          "OcnA" =  "Oceanography", 
                          "PhysA" = "Physics"))
```
## Inputs {.sidebar}

This is where you would write up something that you want the stakeholders to know. What is the overall findings?


Column {data-width=600}
-----------------------------------------------------------------------

### Relationship Between Final grade and Gender

```{r}
data_to_viz %>%
select(subject, final_grade, gender) %>%

ggplot() +
geom_boxplot(mapping = aes(x = final_grade, 
                           #y = gender, 
                           color = gender), alpha = .25) + 
facet_wrap(~subject,ncol = 1) + 
labs  (y = "Course Subject", 
  x = "Final Online Course Grade") + 
 theme_void() +
  theme(legend.position = "bottom",
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        axis.title.x = element_text(),
        axis.text.x = element_text()) +
  scale_color_brewer(palette = "Set1",
                     name = "Gender") +
  scale_x_continuous(breaks = seq(0, 100, by = 5))
```

Column {data-width=350}
-----------------------------------------------------------------------

### Overview of Time Spent on Different Subjects

```{r}
data_to_viz  %>% 
  ggplot() +
  geom_freqpoly(mapping = aes(x = time_spent_hours, color = subject), binwidth = 25, boundary = 0) +
  labs(title = "How long do most of students spend on each subject?") +
  theme_grey()
```

### Relationship Between Time Spent and Interest

```{r}
data_to_viz  %>% 
  ggplot() +
  geom_point(mapping = aes(x = int, 
                       y = time_spent_hours,
                       color = subject),
             alpha = .5) +
  geom_smooth(mapping = aes(x = int, 
                            y = time_spent_hours,
                            weight = .5),
              color = "gray", 
              method = loess,
              se = FALSE) +
  ylim(0, 100) + 
  xlim(1, 5) +
  facet_wrap(~subject) +
  labs(title = "Is there a clear realationship between interest and time spent?",
       y = "Time Spent",
       x = "Interest",
       ) +
  theme_bw() +
  theme(legend.position = "none",
        panel.grid.minor = element_blank()) +
  scale_color_brewer(palette = "Set1",
                     name = "Subject")

```