【R】都道府県別 歩数
2020年2月24日
厚生労働省が、平成22年11月に実施した「国民健康・栄養調査」の結果で都道府県別の肥満及び主な生活習慣の状況から男性と女性(ともに20~歳)の一日当たりの平均歩数を表示してみました。
library(leaflet)
library(knitr)
library(kableExtra)
library(dplyr)
library(tidyr)
library(stringr)
dat <- read.csv("http://www.dinov.tokyo/Data/JP_Pref/Pref_data.csv", header = TRUE, fileEncoding="UTF-8")
col_start <- 0.2
col_end <- 0.0
table_df<-data.frame(都道府県=dat$都道府県, 歩数_女性=dat$歩数_女性, 歩数_男性=dat$歩数_男性)
datc_f <- cut(dat$歩数_女性, hist(dat$歩数_女性, plot=FALSE)$breaks, right=FALSE)
datc_fcol <- rainbow(length(levels(datc_f)), start = col_start, end=col_end)[as.integer(datc_f)]
datc_m <- cut(dat$歩数_男性, hist(dat$歩数_男性, plot=FALSE)$breaks, right=FALSE)
datc_mcol <- rainbow(length(levels(datc_m)), start = col_start, end=col_end)[as.integer(datc_m)]
windowsFonts(JP4=windowsFont("Biz Gothic"))
windows(width=1600, height=800)
par(family="JP4")
layout(matrix(1:2, 1, 2))
library(NipponMap)
JapanPrefMap(datc_fcol, main="歩数_女性 (厚生労働省より) ")
legend("bottomright", fill=rainbow(length(levels(datc_f)), start = col_start, end=col_end), legend=names(table(datc_f)))
JapanPrefMap(datc_mcol, main="歩数_男性 (厚生労働省より) ")
legend("bottomright", fill=rainbow(length(levels(datc_m)), start = col_start, end=col_end), legend=names(table(datc_m)))
library(clipr)
kable(table_df, align = "c") %>%
kable_styling(full_width = F) %>%
column_spec(1, bold = T) %>%
collapse_rows(columns = 1, valign = "middle") %>%
write_clip

| 都道府県 | 歩数_女性 | 歩数_男性 |
|---|---|---|
| 北海道 | 5825 | 6958 |
| 青森 | 5657 | 5976 |
| 岩手 | 6502 | 7265 |
| 宮城 | 5791 | 6479 |
| 秋田 | 5174 | 6232 |
| 山形 | 5618 | 6490 |
| 福島 | 6417 | 7385 |
| 茨城 | 6205 | 6901 |
| 栃木 | 5448 | 6996 |
| 群馬 | 6071 | 6700 |
| 埼玉 | 6488 | 7554 |
| 千葉 | 6422 | 7761 |
| 東京 | 6949 | 7866 |
| 神奈川 | 6988 | 7796 |
| 新潟 | 5630 | 6005 |
| 富山 | 6061 | 6958 |
| 石川 | 6154 | 7114 |
| 福井 | 6122 | 7011 |
| 山梨 | 5152 | 6721 |
| 長野 | 6422 | 7196 |
| 岐阜 | 6278 | 7063 |
| 静岡 | 6504 | 7525 |
| 愛知 | 6421 | 7247 |
| 三重 | 6139 | 7541 |
| 滋賀 | 6442 | 7436 |
| 京都 | 6291 | 7485 |
| 大阪 | 6366 | 7558 |
| 兵庫 | 7063 | 7964 |
| 奈良 | 6688 | 7787 |
| 和歌山 | 5716 | 6178 |
| 鳥取 | 5285 | 5634 |
| 島根 | 5960 | 6716 |
| 岡山 | 6046 | 7595 |
| 広島 | 6309 | 7310 |
| 山口 | 5888 | 6901 |
| 徳島 | 6142 | 6898 |
| 香川 | 5790 | 6695 |
| 愛媛 | 6465 | 6814 |
| 高知 | 6110 | 6390 |
| 福岡 | 6180 | 6655 |
| 佐賀 | 5897 | 6249 |
| 長崎 | 5796 | 6723 |
| 熊本 | 6154 | 6710 |
| 大分 | 6016 | 7063 |
| 宮崎 | 6148 | 7471 |
| 鹿児島 | 5844 | 6717 |
| 沖縄 | 5823 | 7214 |
大都市を擁する都道府県の方が、歩数は少ないようですね。田舎は移動は自動車となりがちなのでしょう。