II) My second dataset is from Chad Smith based on ‘catfish’ survey.I calculated the yearwise and size category wise numbers.Starting with crunching data and tidying it.

collecting data from ‘wide’ to ‘tall’ format

TCFData <- CFData %>%
                gather(Year,Budget,c(2:26))
## Warning: attributes are not identical across measure variables;
## they will be dropped
TCFData$Budget <- as.numeric(gsub(",","",TCFData$Budget))
TCFData$Year <- as.numeric(TCFData$Year)
head(TCFData)
##        Size category Year Budget
## 1       Broodfish 1/ 1992   1491
## 2  Fingerling/fry 2/ 1992 849412
## 3        Stockers 3/ 1992 634353
## 4  Small foodsize 4/ 1992 166731
## 5 Medium foodsize 5/ 1992  70495
## 6  Large foodsize 6/ 1992   6769
ggplot(TCFData,aes(x = reorder(Year,Budget) , y = Budget,color = `Size category`,group = `Size category`))+ geom_line(linetype = "dotted") + geom_point(shape = 20,size = 4) + labs(x = "Year", y = "Budget")+ coord_flip()

The graph makes it clear that there is much variation in amount of size -“Fingerling/fry” over the years.Th prices for Broodfish and and Large foodsize fishes are constant.

To analyze data yearwise,we choose to use “Spread” function.

TSCFdata <- spread(TCFData,`Size category`,`Budget`)
TSCFdata <- data.frame(TSCFdata)
head(TSCFdata)
##   Year Broodfish.1. Fingerling.fry.2. Large.foodsize.6. Medium.foodsize.5.
## 1 1992         1491            849412              6769              70495
## 2 1993         1169            669491              6698              61894
## 3 1994         1183            648628              5196              48851
## 4 1995         1301            724693              4536              59159
## 5 1996         1171            823397              6644              64858
## 6 1997         1163            873457              7810              84725
##   Small.foodsize.4. Stockers.3.
## 1            166731      634353
## 2            153600      571254
## 3            134314      548207
## 4            138160      554342
## 5            156297      627834
## 6            178448      754816
TSCFdata <- na.omit(TSCFdata)
TSCFdata$Broodfish.1. <- as.numeric(gsub(",","",TSCFdata$Broodfish.1.)) 
TSCFdata$Fingerling.fry.2. <- as.numeric(gsub(",","",TSCFdata$Fingerling.fry.2.))
TSCFdata$Large.foodsize.6. <- as.numeric(gsub(",","",TSCFdata$Large.foodsize.6.))
TSCFdata$Medium.foodsize.5. <- as.numeric(gsub(",","",TSCFdata$Medium.foodsize.5.))
TSCFdata$Small.foodsize.4. <- as.numeric(gsub(",","",TSCFdata$Small.foodsize.4.))
TSCFdata$Stockers.3. <- as.numeric(gsub(",","",TSCFdata$Stockers.3.)) 
TSCFData1 <- mutate(TSCFdata,Total = rowSums(TSCFdata[,2:7]))
ggplot(TSCFData1,aes(x = reorder(Year,Total) , y = Total))+ geom_line(linetype = "dotted") + geom_point(shape = 20,size = 4) + ggtitle("Year wise comparison") + labs(x = "Year", y = "Total Inventory Amount",srt = 45)+ coord_flip()
## geom_path: Each group consists of only one observation. Do you need to
## adjust the group aesthetic?

Obeservation shows that year 2016 resulted into much less inventory amount for total catfish purchase.