Charts

Row

Livestock and Milk

Average Producer Prices of Livestock Products

Average Producer Price of Milk

Poultry

Average Producer Price of Broilers

Average Producer Price of Eggs for Consumption

Crops

Average Producer Prices of Cereals

Average Producer Price of Potatoes

Feedstuffs and Fertilisers

Quantity and Cost of Feedstuffs

Quantity and Cost of Fertilisers

Fuel and Interest Rates

Average Prices of Fuel

Bank base lending rate

Reader Information & Contact Details

Reader Information

These statistics are compiled from the Statistical Review of Northern Ireland Agriculture. The Statistical Review of Northern Ireland Agriculture is a compendium of agri-food, environment and rural statistics that is published annually. It is an important reference document for both DAERA stakeholders and policy makers. The data contained in the Statistical Review are derived from farm surveys, as well as surveys of food processors and agricultural input supply firms, administrative data sources, and other environmental and rural data sources.

Red diesel price data is at UK level obtained from the Agriculture and Horticulture Development Board (AHDB).

Contact Details

DAERA Economics & Evaluation Branch is keen to hear your feedback.

Please e-mail comments to

Further information can be found on the DAERA Statistics website https://www.daera-ni.gov.uk/landing-pages/statistics

Row

```

---
title: "Northern Ireland Agricultural Markets Prices 1981 - 2022"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    theme: cerulean
    vertical_layout: scroll
    source_code: embed
    navbar:
      - { title: "Cookies", href: "https://www.daera-ni.gov.uk/cookies", align: right }
---


```{r setup, message=F}

knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)

#LOAD PACKAGES
library(flexdashboard)
library(knitr)
library(crosstalk)
library(DT)
library(tidyverse)
library(plotly)
library(stringr)
library(reshape2)

library(plyr) 

# READ IN THE DATA
MRKT <- read.csv("agric-market-data.csv", header = T, stringsAsFactors = F) 

# TIDY THE DATA UP

kpis <- names(MRKT)[c(3)]
MRKTall <- melt(MRKT, id=1:2)

MRKTall$Sector[MRKTall$Sector == "Finished steers"] <- "Finished steers"
MRKTall$Sector[MRKTall$Sector == "Culled cows and bulls"] <- "Culled cows and bulls"
MRKTall$Sector[MRKTall$Sector == "Finished sheep and lambs"] <- "Finished sheep and lambs"
MRKTall$Sector[MRKTall$Sector == "Finished clean pigs"] <- "Finished clean pigs"
MRKTall$Sector[MRKTall$Sector == "Milk"] <- "Milk"
MRKTall$Sector[MRKTall$Sector == "Broilers"] <- "Broilers"
MRKTall$Sector[MRKTall$Sector == "Eggs for consumption"] <- "Eggs for consumption"
MRKTall$Sector[MRKTall$Sector == "Barley"] <- "Barley"
MRKTall$Sector[MRKTall$Sector == "Wheat"] <- "Wheat"
MRKTall$Sector[MRKTall$Sector == "Oats"] <- "Oats"
MRKTall$Sector[MRKTall$Sector == "Ware Potatoes"] <- "Ware Potatoes"
MRKTall$Sector[MRKTall$Sector == "Average cost of Feedstuffs"] <- "Average cost of Feedstuffs"
MRKTall$Sector[MRKTall$Sector == "Average cost of Fertilisers"] <- "Average cost of Fertilisers"
MRKTall$Sector[MRKTall$Sector == "Quantity of Feedstuffs purchased"] <- "Quantity of Feedstuffs purchased"
MRKTall$Sector[MRKTall$Sector == "Quantity of Fertilisers purchased "] <- "Quantity of Fertilisers purchased"
MRKTall$Sector[MRKTall$Sector == "Red diesel"] <- "Red diesel"

attach(MRKT)


# format variables

MRKTall$Sector  <- factor(MRKTall$Sector)
MRKTall$variable <- factor(MRKTall$variable)


MRKTall$value <- as.numeric(MRKTall$value)


# CREATE FINAL DATAFRAME FOR SHARING
dat <- 
  MRKTall %>%
  arrange(desc(Year))     #Arranging according years

# CREATE A COPY OF dat FOR GRAPHING THAT DOESN'T USE big.mark ","
dat_graph <- dat
dat$value <- sapply(dat$value, format, big.mark = ",")

# CROSSTALK
MRKTkpis <-
  MRKTall %>%
  filter(variable %in% kpis) %>%
  select(Year, Sector, variable, value) 

shared_dat <- SharedData$new(MRKTkpis)
sd_df <- SharedData$new(MRKTkpis, group = shared_dat$groupName())


# CREATE DATAFRAMES TO USE WITH PLOTLY

tidy_dat <- 
  dat_graph


###############################################
################# Total ####################
###############################################

Total <- 
  MRKTall %>%
  filter(variable == "Total") %>%
  select(Year, Sector, value) %>% spread(Sector, value)


post1980 <-
  Total[as.numeric(as.character(Total$Year)) > 1980, ]

ticklabs <- list()



for(i in 1:length(Total$Year)){
  ticklabs[[i]] <- 1980+i
}


tickval <- list()

for(i in 1:length(Total$Year)){
  tickval[[i]] <- 1980+i
 
}


post1980<-post1980%>% mutate_if(is.numeric, round, digits=2)

```



```{r logo, out.width = "175px", echo=FALSE, fig.align='centre'} 

```


Charts {data-icon="fa-chart-line"}
===========================================================
Row {data-height=1025 .tabset .tabset-fade}
-------------------------------------

### **Livestock and Milk**

#### **Average Producer Prices of Livestock Products** 

```{r Livestock}

plot_ly(post1980, x = ~Year, y = ~`Finished steers`, legendgroup = "fcattle", name = 'Finished steers, heifers and young bulls', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>%
  add_trace(x = ~post1980$Year, y = ~post1980$`Culled cows and bulls`, legendgroup = "ccattle", name = 'Culled cows and bulls', mode = 'lines', visible = T, showlegend = T) %>%
   add_trace(x = ~post1980$Year, y = ~post1980$`Finished sheep and lambs`, legendgroup = "sheep", name = 'Finished sheep and lambs', mode = 'lines', visible = T, showlegend = T) %>%
    add_trace(x = ~post1980$Year, y = ~post1980$`Finished clean pigs`, legendgroup = "pigs", name = 'Finished clean pigs', mode = 'lines', visible = T, showlegend = T) %>%
  
  layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5))%>% 
  
    layout(autosize = TRUE)%>%
  

        layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare",hoverinfo="text",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1981, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = TRUE),
         yaxis = list(title = "£ per kg dwt",
                      titlefont = list(size = 12),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE))

```

#### **Average Producer Price of Milk**

```{r milk}
plot_ly(post1980, x = ~Year, y = post1980$`Milk`, legendgroup = "milk", name = 'Milk', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>% 

  layout(showlegend = TRUE)%>% 
  layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5))%>% 
   layout(autosize = TRUE)%>%

  layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare",hoverinfo="all",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1981, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = TRUE),
         yaxis = list(title = "£ per litre",
                      titlefont = list(size = 12),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showlegend = TRUE,
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE))
```

### **Poultry**

#### **Average Producer Price of Broilers**

```{r Broiler}
plot_ly(post1980, x = ~Year, y = post1980$`Broilers`, legendgroup = "broilers", name = 'Broilers', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>% 
   
  layout(showlegend = TRUE)%>% 
  layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5))%>% 

  layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare",hoverinfo="text",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1981, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = TRUE),
         yaxis = list(title = "£ per kg lwt",
                      titlefont = list(size = 12),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE))
```

#### **Average Producer Price of Eggs for Consumption**

```{r Eggs}
plot_ly(post1980, x = ~Year, y = post1980$`Eggs for consumption`, legendgroup = "eggs", name = 'Eggs for consumption', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>% 
   
  layout(showlegend = TRUE)%>% 
  layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5))%>% 

  layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare",hoverinfo="text",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1981, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = TRUE),
         yaxis = list(title = "£ per dozen",
                      titlefont = list(size = 12),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE))
```

### **Crops**

#### **Average Producer Prices of Cereals**


```{r Cereals}
plot_ly(post1980, x = ~Year, y = post1980$`Barley`, legendgroup = "barley", name = 'Barley', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>%
   add_trace(x = ~post1980$Year, y = ~post1980$`Wheat`, legendgroup = "wheat", name = 'Wheat', mode = 'lines', visible = T, showlegend = T) %>%
  add_trace(x = ~post1980$Year, y = ~post1980$`Oats`, legendgroup = "oats", name = 'Oats', mode = 'lines', visible = T, showlegend = T) %>%
  
  layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5))%>% 
   

  layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare",hoverinfo="text",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1981, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = TRUE),
         yaxis = list(title = "£ per tonne",
                      titlefont = list(size = 12),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE))
```

#### **Average Producer Price of Potatoes**

```{r Potatoes}
plot_ly(post1980, x = ~Year, y = post1980$`Ware Potatoes`, legendgroup = "potatoes", name = 'Ware potatoes', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>% 
  
  layout(showlegend = TRUE)%>%
  
  layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5))%>% 

  layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare",hoverinfo="text",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1981, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = TRUE),
         yaxis = list(title = "£ per tonne",
                      titlefont = list(size = 12),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE))
```

### **Feedstuffs and Fertilisers**

#### **Quantity and Cost of Feedstuffs**

```{r Feed}

plot_ly(post1980, x = ~Year, y = post1980$`Quantity of Feedstuffs purchased`, legendgroup = "feedqty", name = 'Quantity of feedstuffs purchased', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>% 
     add_trace(x = ~post1980$Year, y = ~post1980$`Average cost of Feedstuffs`, legendgroup = "feedcost", yaxis = "y2", name = 'Average cost of feedstuffs', mode = 'lines', visible = T, showlegend = T) %>%

    layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5))%>% 
  
  layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare",hoverinfo="text",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1981, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = TRUE),
         yaxis = list(title = "Total quantity of feedstuffs('000 tonnes concentrate equivalent)",
                      titlefont = list(size = 11),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE),
         yaxis2 = list(title = "Average cost of feedstuffs(£ per tonne concentrate equivalent)",
                      overlaying = "y",
                      side = "right",
                      automargin = TRUE,
                      titlefont = list(size = 11),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = F,
                      showline = T,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE))

```

#### **Quantity and Cost of Fertilisers**

```{r Fertiliser}

plot_ly(post1980, x = ~Year, y = post1980$`Quantity of Fertilisers purchased`, legendgroup = "fertqty", name = 'Quantity of fertilisers purchased', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>% 
     add_trace(x = ~post1980$Year, y = ~post1980$`Average cost of Fertilisers`, legendgroup = "fertcost", yaxis = "y2", name = 'Average cost of fertilisers purchased', mode = 'lines', visible = T, showlegend = T) %>%
  
    layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5, y = -0.2))%>% 

  
  layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare",hoverinfo="text",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1981, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = TRUE),
         yaxis = list(title = "Total quantity of  fertilisers('000 tonnes product)",
                      titlefont = list(size = 11),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE),
         yaxis2 = list(title = "Average cost of fertilisers(£ per tonne product)",
                      overlaying = "y",
                      side = "right",
                      automargin = TRUE,
                      titlefont = list(size = 11),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = F,
                      showline = T,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE))

```


### **Fuel and Interest Rates**

#### **Average Prices of Fuel**

```{r Fuel}
plot_ly(post1980, x = ~Year, y = post1980$`Red diesel`, legendgroup = "diesel", name = 'Red diesel', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>% 
  
  layout(showlegend = TRUE)%>%
  
  layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5))%>% 
   

  layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare",hoverinfo="text",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1994, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = TRUE),
         yaxis = list(title = "Average fuel price (pence per litre)",
                      titlefont = list(size = 12),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = TRUE))
```

#### **Bank base lending rate**

```{r Lending}
plot_ly(post1980, x = ~Year, y = post1980$`Bank rate`, legendgroup = "bankrate", name = 'Bank base lending rate', type = 'scatter', mode = 'lines', visible = T, showlegend = T) %>% 
  
  layout(showlegend = TRUE)%>%
  
  layout(legend = list(orientation = 'h', xanchor = "center", x = 0.5))%>% 
   

   layout(title = "",
         paper_bgcolor = 'rgb(255,255,255)', plot_bgcolor = 'rgb(255,255,255)', hovermode = "compare", hoverinfo="text",
         xaxis = list(title = "",
                      gridcolor = 'rgb(255,255,255)',
                      showgrid = FALSE,
                      range = c(1994, max(post1980$Year)),
                      ticktext = ticklabs,
                      tickvals = tickval,
                      showline = TRUE,
                      dtick = 1,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      zeroline = F),
         yaxis = list(title = "Bank base lending rate (%)",
                      titlefont = list(size = 12),
                      gridcolor = 'rgb(229,229,299)',
                      range = c(0, max(Total$Value)),
                      showgrid = TRUE,
                      showline = TRUE,
                      showticklabels = TRUE,
                      tickcolor = 'rgb(127,127,127)',
                      ticks = 'outside',
                      tickformat = ",",
                      zeroline = F))
```


Reader Information & Contact Details {data-icon="fa-chart-line"}
===========================================================

**Reader Information**

*These statistics are compiled from the Statistical Review of Northern Ireland Agriculture. The Statistical Review of Northern Ireland Agriculture is a compendium of agri-food, environment and rural statistics that is published annually. It is an important reference document for both DAERA stakeholders and policy makers. The data contained in the Statistical Review are derived from farm surveys, as well as surveys of food processors and agricultural input supply firms, administrative data sources, and other environmental and rural data sources.* 

*Red diesel price data is at UK level obtained from the Agriculture and Horticulture Development Board (AHDB).*

**Contact Details**

*DAERA Economics & Evaluation Branch is keen to hear your feedback.*

*Please e-mail comments to aeb.econstats@daera-ni.gov.uk*

*Further information can be found on the DAERA Statistics website https://www.daera-ni.gov.uk/landing-pages/statistics*


Row {.tabset .tabset-fade}
-------------------------------------


```