0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

R: パイプの使い方

Last updated at Posted at 2022-10-25

デジタル庁の 新型コロナワクチンの接種状況 のデータを使って、栃木県の 4回目接種数を調べます。

プログラム

tochigi_fourth.R
library(tidyverse)
file_csv <- "https://data.vrs.digital.go.jp/vaccination/opendata/latest/summary_
by_prefecture.csv"
df <- readr::read_csv(file_csv,locale=locale(encoding = "CP932"))
#
df_tochigi <- df %>% select ("date", "prefecture_code" ,"prefecture_name","count
_fourth_shot_general" ) %>% filter(prefecture_name == "栃木県")
head(df_tochigi)

パッケージのインストール

install.packages("tidyverse")

実行結果

$ Rscript tochigi_fourth.R 
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.3.6     ✔ purrr   0.3.4
✔ tibble  3.1.8     ✔ dplyr   1.0.9
✔ tidyr   1.2.0     ✔ stringr 1.4.1
✔ readr   2.1.2     ✔ forcats 0.5.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
Rows: 47 Columns: 11
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (2): prefecture_code, prefecture_name
dbl  (8): count_first_shot_general, count_second_shot_general, count_third_s...
date (1): 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.
# A tibble: 1 × 4
  date       prefecture_code prefecture_name count_fourth_shot_general
  <date>     <chr>           <chr>                               <dbl>
1 2022-10-25 09              栃木県                             655209
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?