Input and Output Analysis

## Row

Beef Input and Output Analysis

Sheep Beef Input and Output Analysis

Beef and Sheep Beef Input Comparison

Beef and Sheep Beef Output Comparison

TFP Over Time

## Row

Beef Analysis of Input, Output and TFP over time

Sheep Beef Analysis of Input, Output and TFP over time

TFP Comparison

## Row

Australian Beef and Sheep Beef TFP trend comparison

References

REFERENCES:

[1] Australian Agricultural Productivity - Broadacre and Dairy Estimates - DAFF. (2021). Agriculture.gov.au. https://www.agriculture.gov.au/abares/research-topics/productivity/agricultural-productivity-estimates#daff-page-main

[2]MyApps Portal. (2019). Instructure.com. https://rmit.instructure.com/courses/124254/modules

[3]Applied Analytics, JAMES BAGLIN, 2016 Available: https://astral-theory-157510.appspot.com/secured/index.html (https://astral-theory-157510.appspot.com/secured/index.html

[4]Holtz, Y. (2018). The R Graph Gallery – Help and inspiration for R charts. The R Graph Gallery. https://r-graph-gallery.com/

---
title: "Australian Beef and Sheep Beef Productivity"
Author: "Yash Yadav"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    social: menu
    source_code: embed
---

```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(readxl)
library(dplyr)
library(plotly)
library(DT)
data_beef <- read.csv("Beef.csv")
data_sheep_beef <- read.csv("Sheep_Beef.csv")

```

Input and Output Analysis
=====================================

## Row {.tabset data-width="400"}
----------------------------------------------------------------------

### Beef Input and Output Analysis

```{r}
fig1 <- plot_ly(data_beef, x = ~Year) %>%
  add_trace(y = ~Input, type = 'scatter', mode = 'lines+markers', fill = 'tozeroy', name = 'Input') %>%
  add_trace(y = ~Output, type = 'scatter', mode = 'lines+markers', fill = 'tonexty', name = 'Output') %>%
  layout(title = "Australian Beef Input vs Output <br> <sub>Input/Output: Aggregate index of all farm inputs/outputs [Note:1977=100]</sub>",
         xaxis = list(title = "Year"),
         yaxis = list(title = "Value"))

fig1
```

### Sheep Beef Input and Output Analysis

```{r}
fig2 <- plot_ly(data_sheep_beef, x = ~Year) %>%
  add_trace(y = ~Input, type = 'scatter', mode = 'lines+markers', fill = 'tozeroy', name = 'Input') %>%
  add_trace(y = ~Output, type = 'scatter', mode = 'lines+markers', fill = 'tonexty', name = 'Output') %>%
  layout(title = "Australian Sheep Beef Input vs Output<br> <sub>Input/Output: Aggregate index of all farm inputs/outputs [Note:1977=100]</sub>",
         xaxis = list(title = "Year"),
         yaxis = list(title = "Value"))

fig2

```

### Beef and Sheep Beef Input Comparison

```{r}
fig3 <- plot_ly(data_beef, x = ~Year) %>%
  add_trace(y = ~Input, type = 'scatter', mode = 'lines', name = 'Beef Input', line = list(color = 'purple')) %>%
  add_trace(data = data_sheep_beef, y = ~Input, type = 'scatter', mode = 'lines', name = 'Sheep_Beef Input', line = list(color = 'yellow'), yaxis = 'y2') %>%
  layout(title = "Australian Beef vs Sheep Beef Input <br> <sub>Input/Output: Aggregate index of all farm inputs/outputs [Note:1977=100]</sub>",
         xaxis = list(title = "Year"),
         yaxis = list(title = "Beef Input"),
         yaxis2 = list(overlaying = 'y', side = 'right', title = 'Sheep Beef Input'))

fig3

```

### Beef and Sheep Beef Output Comparison

```{r}
fig4 <- plot_ly(data_beef, x = ~Year) %>%
  add_trace(y = ~Output, type = 'scatter', mode = 'lines', name = 'Beef Output',line = list(color = 'red')) %>%
  add_trace(data = data_sheep_beef, y = ~Output, type = 'scatter', mode = 'lines', name = 'Sheep_Beef Output',line = list(color = 'blue'), yaxis = 'y2') %>%
  layout(title = "Australian Beef vs Sheep Beef Output <br> <sub>Input/Output: Aggregate index of all farm inputs/outputs [Note:1977=100]</sub>",
         xaxis = list(title = "Year"),
         yaxis = list(title = "Beef Output"),
         yaxis2 = list(overlaying = 'y', side = 'right', title = 'Sheep Beef Output'))

fig4
```

TFP Over Time
=====================================
## Row {.tabset data-width="400"}
----------------------------------------------------------------------

### Beef Analysis of Input, Output and TFP over time

```{r}
fig5 <- plot_ly(data_beef, x = ~Year) %>%
  add_trace(y = ~Input, type = 'scatter', mode="lines", name = 'Input') %>%
  add_trace(y = ~Output, type = 'scatter', mode="lines", name = 'Output') %>%
  add_trace(y = ~TFP, type = 'bar', name = 'TFP (Total Factor Production)', marker = list(color = 'lightgreen')) %>%
  layout(title = " Australian Beef Input and Output vs TFP <br> <sub>TFP: Aggregate index of all farm TFP [Note:1977=100]</sub>",
         xaxis = list(title = "Year"),
         yaxis = list(title = "Value"))

fig5

```

### Sheep Beef Analysis of Input, Output and TFP over time

```{r}
fig6 <- plot_ly(data_sheep_beef, x = ~Year) %>%
  add_trace(y = ~Input, type = 'scatter', mode="lines+markers", name = 'Input') %>%
  add_trace(y = ~Output, type = 'scatter', mode="lines+markers", name = 'Output') %>%
  add_trace(y = ~TFP, type = 'bar', name = 'TFP (Total Factor Production)', marker = list(color = 'lightblue')) %>%
  layout(title = "Australian Sheep Beef Input and Output vs TFP<br><sub>TFP: Aggregate index of all farm TFP [Note:1977=100]</sub>",
         xaxis = list(title = "Year"),
         yaxis = list(title = "Value"))

fig6
```

TFP Comparison
=====================================
## Row {.tabset data-width="400"}
----------------------------------------------------------------------

### Australian Beef and Sheep Beef TFP trend comparison

```{r}
fig7 <- plot_ly(data_beef, x = ~Year) %>%
  add_trace(y = ~data_beef$TFP, type = 'scatter', mode= "lines+markers", name = 'Beef TFP') %>%
  add_trace(y = ~data_sheep_beef$TFP, type = 'scatter', mode= "lines+markers", name = 'Sheep_Beef TFP') %>%
  layout(title = "Beef vs Sheep_Beef TFP<br> <sub>TFP: Aggregate index of all farm TFP [Note:1977=100]</sub>",
         xaxis = list(title = "Year"),
         yaxis = list(title = "Beef TFP"),
         yaxis2 = list(overlaying = 'y', side = 'right', title = 'Sheep_Beef TFP'))
fig7
```

# References

REFERENCES:

[1] Australian Agricultural Productivity - Broadacre and Dairy Estimates - DAFF. (2021). Agriculture.gov.au. <https://www.agriculture.gov.au/abares/research-topics/productivity/agricultural-productivity-estimates#daff-page-main>

[2]MyApps Portal. (2019). Instructure.com. <https://rmit.instructure.com/courses/124254/modules>

[3]Applied Analytics, JAMES BAGLIN, 2016 Available: <https://astral-theory-157510.appspot.com/secured/index.html> (<https://astral-theory-157510.appspot.com/secured/index.html>

[4]Holtz, Y. (2018). The R Graph Gallery – Help and inspiration for R charts. The R Graph Gallery. <https://r-graph-gallery.com/>