# 変数の消去
rm(list = ls())
# パッケージ `pacman`を使って必要なパッケージをインストール
if(!require("pacman")) install.packages("pacman")
## 要求されたパッケージ pacman をロード中です
pacman::p_load("tidyverse",
# 基本のパッケージ
"skimr",
# 記述統計のパッケージ
"gt")
# 表(table)をデータフレームから作るパッケージ
# 表示を科学表示から変更
options(scipen = 999)
#パッケージ読み込み
library(tidyverse)
#directryを指定
setwd("C:/Users/coo/Desktop/data")
getwd()
## [1] "C:/Users/coo/Desktop/data"
dat_temp<-read_csv("QFR2023TermPaper.csv")
## New names:
## Rows: 350 Columns: 5
## ── Column specification
## ────────────────────────────────────────────────────────
## Delimiter: "," chr (1): Fish_Market dbl (4): ...1, Year, Month, Total
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
skimr::skim(dat_temp)
| Name | dat_temp |
| Number of rows | 350 |
| Number of columns | 5 |
| _______________________ | |
| Column type frequency: | |
| character | 1 |
| numeric | 4 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| Fish_Market | 0 | 1 | 8 | 8 | 0 | 2 | 0 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| …1 | 0 | 1 | 175.50 | 101.18 | 1 | 88.25 | 175.5 | 262.75 | 350 | ▇▇▇▇▇ |
| Year | 0 | 1 | 2005.13 | 6.92 | 1994 | 1999.00 | 2005.0 | 2011.00 | 2019 | ▇▇▇▆▃ |
| Month | 0 | 1 | 8.33 | 2.91 | 1 | 7.00 | 9.0 | 11.00 | 12 | ▂▁▅▆▇ |
| Total | 0 | 1 | 2317.37 | 3038.65 | 0 | 1.00 | 640.0 | 4176.50 | 13095 | ▇▂▂▁▁ |
summary_1 <- dat_temp |> group_by(Year, Month)
fig_1 <- ggplot(summary_1, aes(x = Month, y = Total, fill = Year)) +
geom_bar(stat = "identity", position = "dodge")
fig_1
summary_1 <- dat_temp |> group_by(Year, Month) |>mutate(Month = as.factor(Month), Year= as.factor(Year)) |> ungroup()
fig_2 <- ggplot(summary_1, aes(x = Month, y = Total, fill = Year)) +
geom_bar(stat = "identity", position = "dodge")
fig_2
summary_3<-dat_temp|>group_by(Year)
fig_3 <- ggplot(summary_1, aes(x = Year, y = Total)) +
geom_bar(stat = "identity", position = "dodge")
fig_3
#上記のグラフからこの魚は10月をピークとした秋ごろがシーズンの魚であることがわかる。また年間の総漁獲量は2008年が最も多くその後は減少傾向にある。岩手で秋シーズンに漁獲される魚はさけ・ます類、さば、さんまが揚げられる。また岩手の水産業の指標より2008年をピークとし、以降減少傾向で2014年がやや増加しているのはさんまである。また岩手県水産技術センター記載の県内のさんまの水揚げ量のグラフでも同じような漁獲量の変化をしている。これよりこの魚種はさんまであると考えられる。
#〈参考文献〉 #岩手県水産業の指標、岩手、URL:https://www.pref.iwate.jp/sangyoukoyou/nourinsuisan/toukei/1018864/index.html #岩手県水産技術センターWeb、岩手県水産技術センター、URL:https://www2.suigi.pref.iwate.jp/others/tips_saury