library(estatapi)
#> このサービスは、政府統計総合窓口(e-Stat)のAPI機能を使用していますが、サービスの内容は国によって保証されたものではありません。
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)
d <- estat_getStatsData(appId = keyring::key_get("estatapi"), statsDataId = "0003368797")
#> Fetching record 1-2120... (total: 2120 records)
d %>%
filter(
stringr::str_detect(表章項目, "枝肉の.*価"),
stringr::str_detect(と畜種類, "牛")
) %>%
mutate(year = readr::parse_number(`時間軸(年次)`)) %>%
ggplot(aes(year, value, colour = と畜種類)) +
geom_line() +
facet_wrap(vars(表章項目), ncol = 1, scales = "free_y") +
scale_colour_viridis_d(option = "B") +
theme_minimal()
#> Warning: Removed 2 row(s) containing missing values (geom_path).
Created on 2020-04-12 by the reprex package (v0.3.0)