Dataset Description

View of Dataset

Dataset Structure

spc_tbl_ [21,421 × 10] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
 $ District Name: chr [1:21421] "Bagalakot" "Bagalakot" "Bagalakot" "Bagalakot" ...
 $ Taluk Name   : chr [1:21421] "Badami" "Badami" "Badami" "Badami" ...
 $ Market Name  : chr [1:21421] "BADAMI" "BADAMI" "BADAMI" "BADAMI" ...
 $ Address      : chr [1:21421] "SECRATRY A.P.M.C.BADAMI  BADAMI" "SECRATRY A.P.M.C.BADAMI  BADAMI" "SECRATRY A.P.M.C.BADAMI  BADAMI" "SECRATRY A.P.M.C.BADAMI  BADAMI" ...
 $ Telephone    : chr [1:21421] "220042" "220042" "220042" "220042" ...
 $ Commodity    : chr [1:21421] "Bajra" "Bull" "Cow" "Goat" ...
 $ Year         : num [1:21421] 2012 2012 2012 2012 2012 ...
 $ Month        : chr [1:21421] "Jan" "Jan" "Jan" "Jan" ...
 $ Arrival      : num [1:21421] 242 65 151 492 364 ...
 $ Unit         : chr [1:21421] "Quintal" "Numbers" "Numbers" "Numbers" ...
 - attr(*, "spec")=
  .. cols(
  ..   `District Name` = col_character(),
  ..   `Taluk Name` = col_character(),
  ..   `Market Name` = col_character(),
  ..   Address = col_character(),
  ..   Telephone = col_character(),
  ..   Commodity = col_character(),
  ..   Year = col_double(),
  ..   Month = col_character(),
  ..   Arrival = col_double(),
  ..   Unit = col_character()
  .. )
 - attr(*, "problems")=<externalptr> 

Summary of Data

 District Name       Taluk Name        Market Name          Address         
 Length:21421       Length:21421       Length:21421       Length:21421      
 Class :character   Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character   Mode  :character  
                                                                            
                                                                            
                                                                            
  Telephone          Commodity              Year         Month          
 Length:21421       Length:21421       Min.   :2012   Length:21421      
 Class :character   Class :character   1st Qu.:2012   Class :character  
 Mode  :character   Mode  :character   Median :2012   Mode  :character  
                                       Mean   :2012                     
                                       3rd Qu.:2012                     
                                       Max.   :2012                     
    Arrival             Unit          
 Min.   :       0   Length:21421      
 1st Qu.:      52   Class :character  
 Median :     260   Mode  :character  
 Mean   :   33678                     
 3rd Qu.:    1610                     
 Max.   :28856755                     

Univariate Analysis

Analysis of Coconut by month

Analysis of Cow by month

Analysis of Goat by month

Bivariate Analysis(Boxplot)

Commodities arrival across months

Total_Arrivals (Cabbage, Carrot, sunflower)

Scatterplot

Grapes Data By month

---
title: "Karnataka Agricultural Market Data Dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: scroll
    theme: spacelab
    social: menu
    source_code: embed
---

```{r setup, include=FALSE}
library(tidyverse)
library(ggplot2)
library(flexdashboard)
library(lattice)
library(MASS)
library(scales)
library(DT)
library(knitr)

data <- read_csv("C:/Users/USER/Documents/BDA/EDA_assignment/AGRI_MARKET_DATA_KARNATAKA.csv")
```
## Dataset Description {.tabset}
### View of Dataset
```{r}
# Convert data to a data frame or matrix if necessary
data_matrix <- as.matrix(data)
datatable(data,extensions= 'Buttons',options=list(dom = 'Bfrtip',Buttons =c('copy','csv','print','pdf')))
```
### Dataset Structure
```{r}
str(data)
```
### Summary of Data
```{r}
summary(data)
```


```{r}
# Filter data for coconut and group by month to get the total arrival
coconut_arrival <- data %>%
  filter(Commodity == "Coconut") %>%
  group_by(Month) %>%
  summarise(Total_Arrival = sum(Arrival))
```
## Univariate Analysis {.tabset}
### Analysis of Coconut by month
```{r}
# Plot coconut arrival by month (histogram)
ggplot(coconut_arrival, aes(x = Month, y = Total_Arrival)) +
  geom_col(fill = "lightblue") +
  ggtitle("Coconut Arrival by Month") +
  xlab("Month") + ylab("Total Arrival") +
  scale_y_continuous(labels = comma)  # Use comma formatting

```

```{r}
cow_arrival <- data %>%
  filter(Commodity == "Cow") %>%
  group_by(Month) %>%
  summarise(Total_Arrival = sum(Arrival))
```
### Analysis of Cow by month
```{r}
# Plot coconut arrival by moont (histogram)
ggplot(cow_arrival, aes(x = Month, y = Total_Arrival)) +
  geom_col(fill = "lightblue") +
  ggtitle("Cow Arrival by Month") +
  xlab("Month") + ylab("Total Arrival") +
  scale_y_continuous(labels = comma)  # Use comma formatting
```

```{r}
goat_arrival <- data %>%
  filter(Commodity == "Goat") %>%
  group_by(Month) %>%
  summarise(Total_Arrival = sum(Arrival))
```
### Analysis of Goat by month
```{r}

# Plot Goat arrival by moont (histogram)
ggplot(goat_arrival, aes(x = Month, y = Total_Arrival)) +
  geom_col(fill = "lightblue") +
  ggtitle("Goat Arrival by Month") +
  xlab("Month") + ylab("Total Arrival") +
  scale_y_continuous(labels = comma)  # Use comma formatting
```


```{r}
# Filter data for specific commodities 
selected_commodities <- c("Ox", "Cow", "Goat")

filtered_data <- data %>%
  filter(Commodity %in% selected_commodities)
```
## Bivariate Analysis(Boxplot) {.tabset}
### Commodities arrival across months
```{r}
# Boxplot of selected commodities' arrivals across months
ggplot(filtered_data, aes(x = Commodity, y = Arrival, fill = Commodity)) +
  geom_boxplot() +
  ggtitle("Commodity Arrivals (Ox, Cow, Goat)") +
  xlab("Commodity") + ylab("Arrival") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))  # Rotate x-axis labels for clarity

```

```{r}
# Filter data for specific commodities 
specific_commodities <- c("Cabbage", "Carrot", "Sunflower")

filtered_data2 <- data %>%
  filter(Commodity %in% specific_commodities)
```
### Total_Arrivals (Cabbage, Carrot, sunflower)

```{r}
# Boxplot of selected commodities' arrivals across months
ggplot(filtered_data2, aes(x = Commodity, y = Arrival, fill = Commodity)) +
  geom_boxplot() +
  ggtitle("Commodity Arrivals (Ox, Cow, Goat)") +
  xlab("Commodity") + ylab("Arrival") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 100, hjust = 1))  # Rotate x-axis labels for clarity
```

```{r}
grapes_data <- data %>%
  filter(Commodity == "Grapes")
```

## Scatterplot {.tabset}
### Grapes Data By month
```{r}
# Scatterplot of Coconut arrivals by month
ggplot(grapes_data, aes(x = Month, y = Arrival)) +
  geom_point(color = "steelblue", size = 3) +
  ggtitle("Grapes Arrivals by Month") +
  xlab("Month") + ylab("Arrival") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  scale_y_continuous(labels = comma)# Rotate x-axis labels for readability

```