Dataset

Column

source:https://www.education.vic.gov.au/Documents/about/research/VCAMS_Indicator_16_1.xlsx

Summary

row

Apparent retention rate for students,Year 11-Year 12 by state/territory and sector 2021

Visualizations

row

By state/territory and sector 2021

Across Australia, time series

row

By Indigenous status and state/territory

By Gender

---
title: " Apparent retention rate,Year 11-12,2021"
output: 
  flexdashboard::flex_dashboard:
    theme:
      bg: "#FFFFFF"
      fg: "#000000" 
      primary: "#56B4E9"
      base_font:
        google: Prompt
      code_font:
        google: JetBrains Mono
    orientation: rows
    vertical_layout: fill
    source_code: embed
    social: menue
---

```{css}
/* Set font color of inactive tab to green */
.nav-tabs-custom .nav-tabs > li > a {
  color: blue;
} 

/* Set font color of active tab to red */
.nav-tabs-custom .nav-tabs > li.active > a {
  color: grey;
} 
```

```{r setup, include=FALSE}

library(flexdashboard)
library(tidyverse)
library(readxl)
VCAMS_Indicator <- read_excel("C:/Users/Asus/Documents/apparent-retention-dataset.xlsx")
```

# Dataset {data-icon="fa-table"}

## Column {data-width="300"}

### *source:<https://www.education.vic.gov.au/Documents/about/research/VCAMS_Indicator_16_1.xlsx>*

```{r}
library(dplyr)
library(DT)
tab1<- filter(VCAMS_Indicator,
                VCAMS_Indicator$`Year range`== 'Year 11 - Year 12')

tab2<-subset(tab1,select = - c(Fact,`Year range`))

datatable(tab2, filter = 'top',extensions = 'Buttons', options = list(
          pageLength = 10, autoWidth = TRUE, dom='Bfrtip',
          buttons=c('copy', 'csv', 'excel', 'print', 'pdf')))

```

# Summary {data-icon="fa-table"}

## row {data-width="350"}

### Apparent retention rate for students,Year 11-Year 12 by state/territory and sector 2021

```{r}
library(ggplot2)
library(plotly)
tab3<-tab2[order(tab1$`State/territory`), ] %>%
     group_by(`State/territory`, `School sector`) %>% 
     summarise(Frequency = round(mean(`Retention rate`),digits = 1))
tab4<-
      tab3 %>% 
      pivot_wider(names_from= `School sector`, values_from=Frequency) 
datatable(tab4)

```

# Visualizations {data-icon="fa-signal"}

## row {data-width="350"}

### By state/territory and sector 2021

```{r}
library(ggplot2)
library(plotly)
colnames(tab4)[2] <- "Average Retention "
tab4.1=tab4[order(tab4$`Average Retention `,decreasing = TRUE),]
tab4.1$`State/territory`=reorder(tab4.1$`State/territory`,+tab4.1$`Average Retention `)
p <- ggplot(data=tab4.1,aes(x=`State/territory`, y=`Average Retention `, fill=`State/territory`)) +
    
  
    geom_bar(stat="identity")+
  scale_fill_brewer(palette="GnBu")+
    
    theme(legend.position="none",
         panel.background = element_blank())+
  
   ylab("Rate of retention by %") + 
  
   xlab("State/Territory") +
  #ggtitle("Apparent retention rate for students Year 11-Year 12 \n state/territory and sector 2021") +
  
  
  coord_flip()

p<-ggplotly(p)
p
```


### Across Australia, time series

```{r}
library(ggplot2)
library(dplyr)
library(plotly)

tab5<-
VCAMS_Indicator %>% 
  na.omit(tab5)%>%
  group_by(`Calendar year`) %>% 
  summarise(RenetntionRate = round(mean(`Retention rate`),digits = 1))


p <- tab5 %>%
  ggplot( aes(x= `Calendar year`, y= RenetntionRate)) +
      geom_path() +
      geom_point(size = 2)+
 
    ylab("Retention Rate")+
   
    xlim(2010,2021)+
   scale_x_continuous(breaks=seq(2010, 2021, 1))+
  ylim(0,100)+
 # ggtitle("Apparent retention rate for students,Year11-Year12,\n Australia, time series")+
  theme(axis.title.x = element_blank(),
        plot.background = element_blank(),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank())
  
# Turn it interactive with ggplotly
p <- ggplotly(p)
p
```



```{r}
library(ggplot2)
library(plotly)
tab6<-tab2[order(tab2$`Indigenous status`, tab2$`State/territory`), ] %>%
     group_by(`State/territory`,`Indigenous status`) %>% 
    na.omit(tab6)%>%
     summarise(RetentionRate = round(mean(`Retention rate`),digits = 0)) %>% 
      pivot_wider(names_from=`State/territory` , values_from=RetentionRate) 
#datatable(tab6)
```
## row {data-width="350"}
### By Indigenous status and state/territory

```{r}
library(tidyr)
library(plotly)

tab7<- tab6 %>%
 filter(tab6$`Indigenous status` %in% c("Indigenous", "Non-Indigenous"))
tab8<-t(tab7)
tab9=tab8[-c(1),]
col1<-c("Australia","ACT","NSW","NT","Qld","SA","TAS","VIC","WA")
tab9=as.data.frame(tab9)
tab9=cbind(tab9,col1)


tab10<-tab9 %>% pivot_longer(cols=c('V1', 'V2'),
                    names_to='Indigenous Status',
                   values_to='Retention rate')
tab11 <- tab10 %>%
    mutate(`Indigenous Status` = recode(`Indigenous Status`, 	
V1 = 'Indigenous', V2 = 'Non-Indigenous' ))

colnames(tab11)[1] <- "State/Territory"

tab11$`Retention rate`=as.numeric(tab11$`Retention rate`)


 t<- 
ggplot(tab11, aes(x =`State/Territory`, y =`Retention rate`, fill= `Indigenous Status`)) +
  
   geom_col(position = position_dodge())+
   
   scale_fill_manual(values=c("lightseagreen","royalblue4"))+
   
   theme(
       legend.position = "bottom",
        axis.text.x = element_text(angle = 45,hjust=1),
        axis.ticks.x=element_blank(),
         plot.background = element_blank(),
         panel.grid.major = element_blank(),
         panel.grid.minor = element_blank(),
         panel.border = element_blank(),
         axis.title.x = element_blank(),
         axis.text = element_text(size = (8))
       )+
   
  ylim(0,100)+
  ylab("Retention Rate")

 
 ggplotly(t)

```


### By Gender

```{r}
library(tidyr)
library(plotly)

tab12<- tab2 %>%
 filter(tab2$Sex %in% c("Female", "Male"))%>%
  na.omit(tab12)%>%
  group_by(Sex) %>% 
     summarise(Frequency = round(mean(`Retention rate`),digits = 1))


plot_ly(tab12,values= tab12$Frequency,labels= tab12$Sex,marker=list(colors=c("lightseagreen",
                             "royalblue4")),type="pie")
```