# 変数の消去
rm(list = ls())
# パッケージ `pacman`を使って必要なパッケージをインストール
if(!require("pacman")) install.packages("pacman")
## 要求されたパッケージ pacman をロード中です
pacman::p_load("tidyverse",
"skimr")
# 表示を科学表示から変更
options(scipen = 999)
library(readr)
readLines("C:/Users/01102/OneDrive/デスクトップ/データ3/tairyo_navi_Flounder_teaching2023.csv", n = 5)
## [1] "Landing_Date,Market,Gear_Type,Species,Standard,Landing_Amount,Landing_Price,Highest_Price,Average_Price,Lowest_Price"
## [2] "2004-04-03,八木,底刺網,ヒラメ,活魚,1.2,3120,2600,2600,2600"
## [3] "1994-07-05,大槌,小延縄,ヒラメ,活魚,41.6,46011,1869,1106.03,820"
## [4] "2001-08-13,久慈,底刺網,ヒラメ,活魚,470,596807,2760,1269.8,1090"
## [5] "2017-07-12,大船渡,定置網,ヒラメ,山,3.5,1250,0,357.14,0"
market_data_raw <-
readr::read_csv("C:/Users/01102/OneDrive/デスクトップ/データ3/tairyo_navi_Flounder_teaching2023.csv")
## Rows: 1937 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): Market, Gear_Type, Species, Standard
## dbl (5): Landing_Amount, Landing_Price, Highest_Price, Average_Price, Lowes...
## date (1): Landing_Date
##
## ℹ 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.
skimr::skim(market_data_raw)
Data summary
| Name |
market_data_raw |
| Number of rows |
1937 |
| Number of columns |
10 |
| _______________________ |
|
| Column type frequency: |
|
| character |
4 |
| Date |
1 |
| numeric |
5 |
| ________________________ |
|
| Group variables |
None |
Variable type: character
| Market |
0 |
1 |
2 |
3 |
0 |
14 |
0 |
| Gear_Type |
0 |
1 |
2 |
6 |
0 |
11 |
0 |
| Species |
0 |
1 |
3 |
3 |
0 |
1 |
0 |
| Standard |
0 |
1 |
1 |
2 |
0 |
4 |
0 |
Variable type: Date
| Landing_Date |
0 |
1 |
1994-06-20 |
2021-09-03 |
2007-10-06 |
1675 |
Variable type: numeric
| Landing_Amount |
0 |
1 |
17.62 |
44.69 |
-7 |
1.8 |
5.50 |
17.00 |
836.30 |
▇▁▁▁▁ |
| Landing_Price |
0 |
1 |
19936.37 |
55647.62 |
-11188 |
1971.0 |
6491.00 |
21850.00 |
1842700.00 |
▇▁▁▁▁ |
| Highest_Price |
0 |
1 |
1758.92 |
1316.78 |
0 |
860.0 |
1500.00 |
2420.00 |
10000.00 |
▇▃▁▁▁ |
| Average_Price |
0 |
1 |
1341.93 |
1348.62 |
0 |
700.0 |
1092.81 |
1696.03 |
43873.81 |
▇▁▁▁▁ |
| Lowest_Price |
0 |
1 |
801.69 |
845.92 |
0 |
300.0 |
600.00 |
1000.00 |
8500.00 |
▇▁▁▁▁ |
library(readxl)
readxl::excel_sheets("C:/Users/01102/OneDrive/デスクトップ/データ3/tairyo_navi_Flounder_teaching.xlsx")
## [1] "data_2" "data_1"
market_data_raw_xls <- readxl::read_excel("C:/Users/01102/OneDrive/デスクトップ/データ3/tairyo_navi_Flounder_teaching.xlsx")
skimr::skim(market_data_raw_xls)
Data summary
| Name |
market_data_raw_xls |
| Number of rows |
1 |
| Number of columns |
1 |
| _______________________ |
|
| Column type frequency: |
|
| character |
1 |
| ________________________ |
|
| Group variables |
None |
Variable type: character
market_data_raw_xls <- readxl::read_excel("C:/Users/01102/OneDrive/デスクトップ/データ3/tairyo_navi_Flounder_teaching.xlsx", sheet = "data_1")
skimr::skim(market_data_raw_xls)
Data summary
| Name |
market_data_raw_xls |
| Number of rows |
193738 |
| Number of columns |
10 |
| _______________________ |
|
| Column type frequency: |
|
| character |
4 |
| numeric |
5 |
| POSIXct |
1 |
| ________________________ |
|
| Group variables |
None |
Variable type: character
| Market |
0 |
1 |
2 |
3 |
0 |
14 |
0 |
| Gear_Type |
0 |
1 |
2 |
10 |
0 |
23 |
0 |
| Species |
0 |
1 |
2 |
3 |
0 |
3 |
0 |
| Standard |
0 |
1 |
1 |
2 |
0 |
8 |
0 |
Variable type: numeric
| Landing_Amount |
0 |
1 |
18.75 |
44.28 |
-58.40 |
1.80 |
5.6 |
18.00 |
4181.8 |
▇▁▁▁▁ |
| Landing_Price |
0 |
1 |
19843.10 |
37140.40 |
-101196.00 |
1901.00 |
6760.0 |
21780.00 |
1992600.0 |
▇▁▁▁▁ |
| Highest_Price |
0 |
1 |
1736.06 |
1312.04 |
0.00 |
800.00 |
1500.0 |
2400.00 |
15800.0 |
▇▁▁▁▁ |
| Average_Price |
0 |
1 |
1304.34 |
1045.87 |
-5197.06 |
684.55 |
1075.0 |
1660.45 |
91100.0 |
▇▁▁▁▁ |
| Lowest_Price |
0 |
1 |
785.80 |
815.32 |
-5000.00 |
300.00 |
580.0 |
1000.00 |
10700.0 |
▁▇▂▁▁ |
Variable type: POSIXct
| Landing_Date |
0 |
1 |
1994-01-05 |
2021-09-08 |
2007-08-08 |
8233 |
# 変数の消去
rm(list = ls())
# パッケージ `pacman`を使って必要なパッケージをインストール
if(!require("pacman")) install.packages("pacman")
pacman::p_load("tidyverse",
"skimr", "gt")
# 表示を科学表示から変更
options(scipen = 999)
library(skimr) # 表を作るパッケージ
market_data_raw <-
readr::read_csv("C:/Users/01102/OneDrive/デスクトップ/データ3/tairyo_navi_Flounder_teaching2023.csv")
## Rows: 1937 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): Market, Gear_Type, Species, Standard
## dbl (5): Landing_Amount, Landing_Price, Highest_Price, Average_Price, Lowes...
## date (1): Landing_Date
##
## ℹ 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.
market_data_raw |> skimr::skim()
Data summary
| Name |
market_data_raw |
| Number of rows |
1937 |
| Number of columns |
10 |
| _______________________ |
|
| Column type frequency: |
|
| character |
4 |
| Date |
1 |
| numeric |
5 |
| ________________________ |
|
| Group variables |
None |
Variable type: character
| Market |
0 |
1 |
2 |
3 |
0 |
14 |
0 |
| Gear_Type |
0 |
1 |
2 |
6 |
0 |
11 |
0 |
| Species |
0 |
1 |
3 |
3 |
0 |
1 |
0 |
| Standard |
0 |
1 |
1 |
2 |
0 |
4 |
0 |
Variable type: Date
| Landing_Date |
0 |
1 |
1994-06-20 |
2021-09-03 |
2007-10-06 |
1675 |
Variable type: numeric
| Landing_Amount |
0 |
1 |
17.62 |
44.69 |
-7 |
1.8 |
5.50 |
17.00 |
836.30 |
▇▁▁▁▁ |
| Landing_Price |
0 |
1 |
19936.37 |
55647.62 |
-11188 |
1971.0 |
6491.00 |
21850.00 |
1842700.00 |
▇▁▁▁▁ |
| Highest_Price |
0 |
1 |
1758.92 |
1316.78 |
0 |
860.0 |
1500.00 |
2420.00 |
10000.00 |
▇▃▁▁▁ |
| Average_Price |
0 |
1 |
1341.93 |
1348.62 |
0 |
700.0 |
1092.81 |
1696.03 |
43873.81 |
▇▁▁▁▁ |
| Lowest_Price |
0 |
1 |
801.69 |
845.92 |
0 |
300.0 |
600.00 |
1000.00 |
8500.00 |
▇▁▁▁▁ |
market_data_raw |> distinct(Market)
## # A tibble: 14 × 1
## Market
## <chr>
## 1 八木
## 2 大槌
## 3 久慈
## 4 大船渡
## 5 宮古
## 6 船越
## 7 釜石
## 8 山田
## 9 田野畑
## 10 田老
## 11 普代
## 12 野田
## 13 種市
## 14 細浦
market_data_raw |> ggplot(aes(x = Market)) + geom_bar() + theme(text = element_text(family = "HiraKakuPro-W3"))
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): Windows
## のフォントデータベースにフォントファミリが見付かりません
## Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): Windows
## のフォントデータベースにフォントファミリが見付かりません
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows のフォントデータベースにフォントファミリが見付かりません
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows のフォントデータベースにフォントファミリが見付かりません
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows のフォントデータベースにフォントファミリが見付かりません
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows のフォントデータベースにフォントファミリが見付かりません
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows のフォントデータベースにフォントファミリが見付かりません
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows のフォントデータベースにフォントファミリが見付かりません
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## Windows のフォントデータベースにフォントファミリが見付かりません

market_data_raw |> group_by(Market) |> summarize(n =n())
## # A tibble: 14 × 2
## Market n
## <chr> <int>
## 1 久慈 265
## 2 八木 152
## 3 大槌 108
## 4 大船渡 306
## 5 宮古 307
## 6 山田 138
## 7 普代 88
## 8 田老 72
## 9 田野畑 76
## 10 種市 50
## 11 細浦 2
## 12 船越 105
## 13 野田 88
## 14 釜石 180
market_data_raw |> group_by(Species) |> summarize(n =n())
## # A tibble: 1 × 2
## Species n
## <chr> <int>
## 1 ヒラメ 1937