Author: Tomonori Hoshi, Erina Ishigaki, Sathoshi Kaneko
Date: 2026-05-17

# jpinfect: Notifiable Infectious Diseases in Japan

#### Tomonori Hoshi, Erina Ishigaki, Sathoshi Kaneko

#### 2026-05-17

# Introduction

The `jpinfect` package provides tools for acquiring and processing notifiable infectious disease data in Japan. The package includes built-in datasets and functions to download, read and manipulate data from the Japan Institute for Health Security (JIHS). It also provides functions to merge datasets, transform data formats and check data sources.

This package is designed to assist researchers, epidemiologists, public health officials and developers in accessing, cleaning, and manipulating data for epidemiological analysis. The package is particularly useful for those working with infectious disease data in Japan, as it provides a streamlined process for obtaining and processing data from the JIHS.

### Dependencies

The `jpinfect` package depends on the following R packages:

- `dplyr`: for data manipulation

- `future`: for parallel processing

- `future.apply`: for parallel processing

- `httr`: for HTTP requests

- `magrittr`: for piping

- `readr`: for reading CSV files

- `readxl`: for reading Excel files

- `stats`: for statistical functions

- `stringi`: for string manipulation

- `stringr`: for string manipulation

- `tidyr`: for data tidying

- `tidyselect`: for data selection

- `utils`: for utility functions

## Installation

The `jpinfect` package can be installed from either CRAN or GitHub using the remotes package. Through the Github repository, the latest Provisional weekly Case Reports (bullet) data can be acquired, which may not be available on CRAN. To install the package, run the following command in your R console:

From CRAN:

    install.packages("jpinfect")

From GitHub (for the latest version):

    if(!require("remotes")) install.packages("remotes")
    remotes::install_github("TomonoriHoshi/jpinfect")

Load the package after installation:

    library(jpinfect)

## Usage

### Built-in Datasets

The `jpinfect` package includes three built-in datasets that can be used to start immediate data analysis. These datasets are:

- `sex_prefecture`: Confirmed weekly case reports on the sex distribution of reported cases by prefecture from 1999 to 2023.

- `place_prefecture`: Confirmed weekly case reports about the place of infection by prefecture between 2001 and 2023.

- `bullet`: Provisional weekly case reported by prefecture from 2024 to the current latest reports.

These datasets are provided in a tidy format, making them easy to work with using the `dplyr` and `tidyr` packages.

    data("sex_prefecture")
    data("place_prefecture")
    data("bullet")

#### Data Exploration

    str(sex_prefecture)
    #> tibble [64,416 × 319] (S3: tbl_df/tbl/data.frame)
    #>  $ prefecture                                                      : chr [1:64416] "Total" "Hokkaido" "Aomori" "Iwate" ...
    #>  $ year                                                            : int [1:64416] 1999 1999 1999 1999 1999 1999 1999 1999 1999 1999 ...
    #>  $ week                                                            : int [1:64416] 14 14 14 14 14 14 14 14 14 14 ...
    #>  $ date                                                            : Date[1:64416], format: "1999-04-11" "1999-04-11" ...
    #>  $ Ebola hemorrhagic fever (total)                                 : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Ebola hemorrhagic fever (male)                                  : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Ebola hemorrhagic fever (female)                                : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Crimean-Congo hemorrhagic fever (total)                         : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Crimean-Congo hemorrhagic fever (male)                          : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Crimean-Congo hemorrhagic fever (female)                        : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Plague (total)                                                  : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Plague (male)                                                   : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Plague (female)                                                 : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Marburg disease (total)                                         : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Marburg disease (male)                                          : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Marburg disease (female)                                        : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Lassa fever (total)                                             : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Lassa fever (male)                                              : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Lassa fever (female)                                            : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cholera (total)                                                 : int [1:64416] 2 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cholera (male)                                                  : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cholera (female)                                                : int [1:64416] 2 0 0 0 0 0 0 0 0 0 ...
    #>  $ Shigellosis (total)                                             : int [1:64416] 21 1 0 0 0 0 0 1 0 0 ...
    #>  $ Shigellosis (male)                                              : int [1:64416] 9 1 0 0 0 0 0 1 0 0 ...
    #>  $ Shigellosis (female)                                            : int [1:64416] 12 0 0 0 0 0 0 0 0 0 ...
    #>  $ Typhoid fever (total)                                           : int [1:64416] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Typhoid fever (male)                                            : int [1:64416] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Typhoid fever (female)                                          : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Paratyphoid fever (total)                                       : int [1:64416] 5 1 0 0 0 0 0 0 0 0 ...
    #>  $ Paratyphoid fever (male)                                        : int [1:64416] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Paratyphoid fever (female)                                      : int [1:64416] 4 1 0 0 0 0 0 0 0 0 ...
    #>  $ Acute poliomyelitis (total)                                     : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Acute poliomyelitis (male)                                      : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Acute poliomyelitis (female)                                    : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Diphtheria (total)                                              : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Diphtheria (male)                                               : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Diphtheria (female)                                             : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Enterohemorrhagic E. coli infection (total)                     : int [1:64416] 20 0 0 2 0 0 0 0 0 0 ...
    #>  $ Enterohemorrhagic E. coli infection (male)                      : int [1:64416] 12 0 0 2 0 0 0 0 0 0 ...
    #>  $ Enterohemorrhagic E. coli infection (female)                    : int [1:64416] 8 0 0 0 0 0 0 0 0 0 ...
    #>  $ Amebiasis (total)                                               : int [1:64416] 9 1 0 0 0 0 0 0 1 0 ...
    #>  $ Amebiasis (male)                                                : int [1:64416] 9 1 0 0 0 0 0 0 1 0 ...
    #>  $ Amebiasis (female)                                              : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Echinococcosis (total)                                          : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Echinococcosis (male)                                           : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Echinococcosis (female)                                         : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Yellow fever (total)                                            : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Yellow fever (male)                                             : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Yellow fever (female)                                           : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Psittacosis (total)                                             : int [1:64416] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Psittacosis (male)                                              : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Psittacosis (female)                                            : int [1:64416] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Relapsing fever (total)                                         : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Relapsing fever (male)                                          : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Relapsing fever (female)                                        : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Acute viral hepatitis (total)                                   : int [1:64416] 52 1 0 1 2 0 0 0 2 0 ...
    #>  $ Acute viral hepatitis (male)                                    : int [1:64416] 28 1 0 1 1 0 0 0 1 0 ...
    #>  $ Acute viral hepatitis (female)                                  : int [1:64416] 24 0 0 0 1 0 0 0 1 0 ...
    #>  $ Q fever (total)                                                 : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Q fever (male)                                                  : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Q fever (female)                                                : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Rabies (total)                                                  : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Rabies (male)                                                   : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Rabies (female)                                                 : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cryptosporidiosis (total)                                       : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cryptosporidiosis (male)                                        : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cryptosporidiosis (female)                                      : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Creutzfeldt-Jakob disease (total)                               : int [1:64416] 2 0 0 0 0 0 0 0 0 0 ...
    #>  $ Creutzfeldt-Jakob disease (male)                                : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Creutzfeldt-Jakob disease (female)                              : int [1:64416] 2 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe invasive streptococcal infections (total)                : int [1:64416] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe invasive streptococcal infections (male)                 : int [1:64416] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe invasive streptococcal infections (female)               : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ AIDS (total)                                                    : int [1:64416] 18 0 0 0 0 0 0 0 0 0 ...
    #>  $ AIDS (male)                                                     : int [1:64416] 15 0 0 0 0 0 0 0 0 0 ...
    #>  $ AIDS (female)                                                   : int [1:64416] 3 0 0 0 0 0 0 0 0 0 ...
    #>  $ Coccidioidomycosis (total)                                      : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Coccidioidomycosis (male)                                       : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Coccidioidomycosis (female)                                     : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Giardiasis (total)                                              : int [1:64416] 2 0 0 0 0 0 0 0 0 0 ...
    #>  $ Giardiasis (male)                                               : int [1:64416] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Giardiasis (female)                                             : int [1:64416] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hemorrhagic fever with renal syndrome (total)                   : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hemorrhagic fever with renal syndrome (male)                    : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hemorrhagic fever with renal syndrome (female)                  : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Meningococcal meningitis (total)                                : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Meningococcal meningitis (male)                                 : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Meningococcal meningitis (female)                               : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Congenital rubella syndrome (total)                             : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Congenital rubella syndrome (male)                              : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Congenital rubella syndrome (female)                            : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Anthrax (total)                                                 : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Anthrax (male)                                                  : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Anthrax (female)                                                : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Tsutsugamushi disease (total)                                   : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Tsutsugamushi disease (male)                                    : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Tsutsugamushi disease (female)                                  : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Dengue fever (total)                                            : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Dengue fever (male)                                             : int [1:64416] 0 0 0 0 0 0 0 0 0 0 ...
    #>   [list output truncated]

    str(place_prefecture)
    #> tibble [60,048 × 424] (S3: tbl_df/tbl/data.frame)
    #>  $ prefecture                                                            : chr [1:60048] "Total" "Hokkaido" "Aomori" "Iwate" ...
    #>  $ year                                                                  : int [1:60048] 2001 2001 2001 2001 2001 2001 2001 2001 2001 2001 ...
    #>  $ week                                                                  : int [1:60048] 1 1 1 1 1 1 1 1 1 1 ...
    #>  $ date                                                                  : Date[1:60048], format: "2001-01-07" "2001-01-07" ...
    #>  $ Ebola hemorrhagic fever (total)                                       : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Ebola hemorrhagic fever (Inside Japan)                                : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Ebola hemorrhagic fever (Others)                                      : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Ebola hemorrhagic fever (Unknown)                                     : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Crimean-Congo hemorrhagic fever (total)                               : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Crimean-Congo hemorrhagic fever (Inside Japan)                        : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Crimean-Congo hemorrhagic fever (Others)                              : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Crimean-Congo hemorrhagic fever (Unknown)                             : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Plague (total)                                                        : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Plague (Inside Japan)                                                 : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Plague (Others)                                                       : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Plague (Unknown)                                                      : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Marburg disease (total)                                               : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Marburg disease (Inside Japan)                                        : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Marburg disease (Others)                                              : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Marburg disease (Unknown)                                             : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Lassa fever (total)                                                   : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Lassa fever (Inside Japan)                                            : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Lassa fever (Others)                                                  : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Lassa fever (Unknown)                                                 : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cholera (total)                                                       : int [1:60048] 2 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cholera (Inside Japan)                                                : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cholera (Others)                                                      : int [1:60048] 2 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cholera (Unknown)                                                     : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Shigellosis (total)                                                   : int [1:60048] 6 0 0 0 0 0 0 0 0 0 ...
    #>  $ Shigellosis (Inside Japan)                                            : int [1:60048] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Shigellosis (Others)                                                  : int [1:60048] 5 0 0 0 0 0 0 0 0 0 ...
    #>  $ Shigellosis (Unknown)                                                 : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Typhoid fever (total)                                                 : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Typhoid fever (Inside Japan)                                          : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Typhoid fever (Others)                                                : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Typhoid fever (Unknown)                                               : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Paratyphoid fever (total)                                             : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Paratyphoid fever (Inside Japan)                                      : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Paratyphoid fever (Others)                                            : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Paratyphoid fever (Unknown)                                           : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Poliomyelitis (total)                                                 : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Poliomyelitis (Inside Japan)                                          : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Poliomyelitis (Others)                                                : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Poliomyelitis (Unknown)                                               : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Diphtheria (total)                                                    : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Diphtheria (Inside Japan)                                             : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Diphtheria (Others)                                                   : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Diphtheria (Unknown)                                                  : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Enterohemorrhagic E. coli infection (total)                           : int [1:60048] 12 0 1 0 0 0 0 0 0 0 ...
    #>  $ Enterohemorrhagic E. coli infection (Inside Japan)                    : int [1:60048] 10 0 0 0 0 0 0 0 0 0 ...
    #>  $ Enterohemorrhagic E. coli infection (Others)                          : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Enterohemorrhagic E. coli infection (Unknown)                         : int [1:60048] 2 0 1 0 0 0 0 0 0 0 ...
    #>  $ Amebiasis (total)                                                     : int [1:60048] 3 0 0 0 0 0 0 0 0 0 ...
    #>  $ Amebiasis (Inside Japan)                                              : int [1:60048] 2 0 0 0 0 0 0 0 0 0 ...
    #>  $ Amebiasis (Others)                                                    : int [1:60048] 1 0 0 0 0 0 0 0 0 0 ...
    #>  $ Amebiasis (Unknown)                                                   : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Echinococcosis (total)                                                : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Echinococcosis (Inside Japan)                                         : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Echinococcosis (Others)                                               : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Echinococcosis (Unknown)                                              : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Yellow fever (total)                                                  : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Yellow fever (Inside Japan)                                           : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Yellow fever (Others)                                                 : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Yellow fever (Unknown)                                                : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Psittacosis (total)                                                   : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Psittacosis (Inside Japan)                                            : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Psittacosis (Others)                                                  : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Psittacosis (Unknown)                                                 : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Relapsing fever (total)                                               : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Relapsing fever (Inside Japan)                                        : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Relapsing fever (Others)                                              : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Relapsing fever (Unknown)                                             : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Acute viral hepatitis (total)                                         : int [1:60048] 1 0 0 0 1 0 0 0 0 0 ...
    #>  $ Acute viral hepatitis (Inside Japan)                                  : int [1:60048] 1 0 0 0 1 0 0 0 0 0 ...
    #>  $ Acute viral hepatitis (Others)                                        : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Acute viral hepatitis (Unknown)                                       : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Q fever (total)                                                       : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Q fever (Inside Japan)                                                : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Q fever (Others)                                                      : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Q fever (Unknown)                                                     : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Rabies (total)                                                        : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Rabies (Inside Japan)                                                 : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Rabies (Others)                                                       : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Rabies (Unknown)                                                      : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cryptosporidiosis (total)                                             : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cryptosporidiosis (Inside Japan)                                      : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cryptosporidiosis (Others)                                            : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cryptosporidiosis (Unknown)                                           : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Creutzfeldt-Jakob disease (total)                                     : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Creutzfeldt-Jakob disease (Inside Japan)                              : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Creutzfeldt-Jakob disease (Others)                                    : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Creutzfeldt-Jakob disease (Unknown)                                   : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe invasive streptococcal infections (total)                      : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe invasive streptococcal infections (Inside Japan)               : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe invasive streptococcal infections (Others)                     : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe invasive streptococcal infections (Unknown)                    : int [1:60048] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ AIDS (total)                                                          : int [1:60048] 9 0 0 0 0 0 0 0 1 0 ...
    #>  $ AIDS (Inside Japan)                                                   : int [1:60048] 7 0 0 0 0 0 0 0 1 0 ...
    #>  $ AIDS (Others)                                                         : int [1:60048] 1 0 0 0 0 0 0 0 0 0 ...
    #>   [list output truncated]

    str(bullet)
    #> tibble [3,360 × 180] (S3: tbl_df/tbl/data.frame)
    #>  $ prefecture                                                               : chr [1:3360] "Total" "Hokkaido" "Aomori" "Iwate" ...
    #>  $ year                                                                     : int [1:3360] 2025 2025 2025 2025 2025 2025 2025 2025 2025 2025 ...
    #>  $ week                                                                     : int [1:3360] 1 1 1 1 1 1 1 1 1 1 ...
    #>  $ date                                                                     : Date[1:3360], format: "2025-01-05" "2025-01-05" ...
    #>  $ Ebola hemorrhagic fever (weekly)                                         : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Ebola hemorrhagic fever (cumulative)                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Crimean-Congo hemorrhagic fever (weekly)                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Crimean-Congo hemorrhagic fever (cumulative)                             : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Smallpox (weekly)                                                        : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Smallpox (cumulative)                                                    : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ South American hemorrhagic fever (weekly)                                : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ South American hemorrhagic fever (cumulative)                            : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Plague (weekly)                                                          : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Plague (cumulative)                                                      : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Marburg disease (weekly)                                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Marburg disease (cumulative)                                             : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Lassa fever (weekly)                                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Lassa fever (cumulative)                                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Acute poliomyelitis (weekly)                                             : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Acute poliomyelitis (cumulative)                                         : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Tuberculosis (weekly)                                                    : int [1:3360] 23 0 1 0 1 0 0 0 1 1 ...
    #>  $ Tuberculosis (cumulative)                                                : int [1:3360] 23 0 1 0 1 0 0 0 1 1 ...
    #>  $ Diphtheria (weekly)                                                      : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Diphtheria (cumulative)                                                  : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe Acute Respiratory Syndrome (SARS) (weekly)                        : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe Acute Respiratory Syndrome (SARS) (cumulative)                    : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Middle East Respiratory Syndrome Coronavirus (weekly)                    : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Middle East Respiratory Syndrome Coronavirus (cumulative)                : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Avian influenza H5N1 (weekly)                                            : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Avian influenza H5N1 (cumulative)                                        : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Avian influenza H7N9 (weekly)                                            : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Avian influenza H7N9 (cumulative)                                        : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cholera (weekly)                                                         : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Cholera (cumulative)                                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Shigellosis (weekly)                                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Shigellosis (cumulative)                                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Enterohemorrhagic Escherichia coli infection (weekly)                    : int [1:3360] 9 1 0 0 0 0 0 0 0 0 ...
    #>  $ Enterohemorrhagic Escherichia coli infection (cumulative)                : int [1:3360] 9 1 0 0 0 0 0 0 0 0 ...
    #>  $ Typhoid fever (weekly)                                                   : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Typhoid fever (cumulative)                                               : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Paratyphoid fever (weekly)                                               : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Paratyphoid fever (cumulative)                                           : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hepatitis E (weekly)                                                     : int [1:3360] 1 1 0 0 0 0 0 0 0 0 ...
    #>  $ Hepatitis E (cumulative)                                                 : int [1:3360] 1 1 0 0 0 0 0 0 0 0 ...
    #>  $ West Nile fever (weekly)                                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ West Nile fever (cumulative)                                             : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hepatitis A (weekly)                                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hepatitis A (cumulative)                                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Echinococcosis (weekly)                                                  : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Echinococcosis (cumulative)                                              : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Mpox (weekly)                                                            : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Mpox (cumulative)                                                        : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Yellow fever (weekly)                                                    : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Yellow fever (cumulative)                                                : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Psittacosis (weekly)                                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Psittacosis (cumulative)                                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Omsk hemorrhagic fever (weekly)                                          : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Omsk hemorrhagic fever (cumulative)                                      : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Relapsing fever (weekly)                                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Relapsing fever (cumulative)                                             : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Kyasanur forest disease (weekly)                                         : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Kyasanur forest disease (cumulative)                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Q fever (weekly)                                                         : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Q fever (cumulative)                                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Rabies (weekly)                                                          : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Rabies (cumulative)                                                      : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Coccidioidomycosis (weekly)                                              : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Coccidioidomycosis (cumulative)                                          : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Zika virus infection (weekly)                                            : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Zika virus infection (cumulative)                                        : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe Fever with Thrombocytopenia Syndrome (SFTS) (weekly)              : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Severe Fever with Thrombocytopenia Syndrome (SFTS) (cumulative)          : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hemorrhagic fever with renal syndrome (weekly)                           : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hemorrhagic fever with renal syndrome (cumulative)                       : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Western equine encephalitis (weekly)                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Western equine encephalitis (cumulative)                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Tick-borne encephalitis (weekly)                                         : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Tick-borne encephalitis (cumulative)                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Anthrax (weekly)                                                         : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Anthrax (cumulative)                                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Chikungunya fever (weekly)                                               : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Chikungunya fever (cumulative)                                           : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Scrub typhus (Tsutsugamushi disease) (weekly)                            : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Scrub typhus (Tsutsugamushi disease) (cumulative)                        : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Dengue fever (weekly)                                                    : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Dengue fever (cumulative)                                                : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Eastern equine encephalitis (weekly)                                     : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Eastern equine encephalitis (cumulative)                                 : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Avian influenza (exclud. Avian influenza both H5N1 and H7N9) (weekly)    : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Avian influenza (exclud. Avian influenza both H5N1 and H7N9) (cumulative): int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Nipah virus infection (weekly)                                           : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Nipah virus infection (cumulative)                                       : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Japanese spotted fever (weekly)                                          : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Japanese spotted fever (cumulative)                                      : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Japanese encephalitis (weekly)                                           : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Japanese encephalitis (cumulative)                                       : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hantavirus pulmonary syndrome (weekly)                                   : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Hantavirus pulmonary syndrome (cumulative)                               : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>  $ Herpes B virus infection (weekly)                                        : int [1:3360] 0 0 0 0 0 0 0 0 0 0 ...
    #>   [list output truncated]

### Data Merging

The `jpinfect_merge` function helps to merge the datasets into one dataset if necessary, which enables users to start their data analysis instantly.

    # Load the built-in datasets
    data("sex_prefecture")
    data("place_prefecture")
    data("bullet")

    # Merge two datasets
    confirmed_dataset <- jpinfect_merge(sex_prefecture, place_prefecture)

    # Merge three datasets
    bind_result <- jpinfect_merge(sex_prefecture, place_prefecture, bullet)

#### Data Exploration

    # Check the structure of the merged dataset
    head(confirmed_dataset)

    head(bind_result)

### Data Transformation from Wider to Longer; Vice Versa

The `jpinfect_pivot` function enables users to seamlessly pivot datasets between wide and long formats. This functionality is particularly useful for reorganising data to suit analysis or visualisation needs.

    # Convert from wide to long format
    bullet_long <- jpinfect_pivot(bullet)

    # Convert from long to wide format
    bullet_wide <- jpinfect_pivot(bullet_long)

#### Data Exploration

    # Check the structure of long format
    head(bullet_long)
    #> # A tibble: 6 × 6
    #>   prefecture  year  week date       disease                                cases
    #>   <chr>      <int> <int> <date>     <chr>                                  <int>
    #> 1 Total       2025     1 2025-01-05 Ebola hemorrhagic fever (weekly)           0
    #> 2 Total       2025     1 2025-01-05 Ebola hemorrhagic fever (cumulative)       0
    #> 3 Total       2025     1 2025-01-05 Crimean-Congo hemorrhagic fever (week…     0
    #> 4 Total       2025     1 2025-01-05 Crimean-Congo hemorrhagic fever (cumu…     0
    #> 5 Total       2025     1 2025-01-05 Smallpox (weekly)                          0
    #> 6 Total       2025     1 2025-01-05 Smallpox (cumulative)                      0

    # Check the structure of wide format
    head(bullet_wide)
    #> # A tibble: 6 × 180
    #>   prefecture  year  week date       `Ebola hemorrhagic fever (weekly)`
    #>   <chr>      <int> <int> <date>                                  <int>
    #> 1 Total       2025     1 2025-01-05                                  0
    #> 2 Hokkaido    2025     1 2025-01-05                                  0
    #> 3 Aomori      2025     1 2025-01-05                                  0
    #> 4 Iwate       2025     1 2025-01-05                                  0
    #> 5 Miyagi      2025     1 2025-01-05                                  0
    #> 6 Akita       2025     1 2025-01-05                                  0
    #> # ℹ 175 more variables: `Ebola hemorrhagic fever (cumulative)` <int>,
    #> #   `Crimean-Congo hemorrhagic fever (weekly)` <int>,
    #> #   `Crimean-Congo hemorrhagic fever (cumulative)` <int>,
    #> #   `Smallpox (weekly)` <int>, `Smallpox (cumulative)` <int>,
    #> #   `South American hemorrhagic fever (weekly)` <int>,
    #> #   `South American hemorrhagic fever (cumulative)` <int>,
    #> #   `Plague (weekly)` <int>, `Plague (cumulative)` <int>, …

## Building Datasets from Source

Although the build-in datasets are provided in this package, it is ideal for scientists, epidemiologists and public health officers to review whole data handling process from the upstream to downstream. For those who cares the precision of dataset, `jpinfect` provides the following functions to build the same datasets or even the latest bullet datasets sourced from the government-provided raw data.

### Data Source Checks

The sources of these datasets can be checked by using `jpinfect_url_confirmed` for confirmed case reports and `jpinfect_url_bullet` for provisional case reports, respectively.

    # Check data source URL for sex and prefecture data
    jpinfect_url_confirmed(year = 2021, type = "sex")

    # Check data source URL for place of infection and prefecture data
    jpinfect_url_confirmed(year = 2021, type = "place")

### Data Acquisition

The raw data can be downloaded using `jpinfect_get_confirmed` for confirmed case reports and `jpinfect_get_bullet` for provisional case reports, respectively. Confirmed weekly case data is organised into a single Microsoft Excel file for each year, while provisional data is provided as separate CSV files for each week. Since this function connect to the government website, it may take some time to download the data. To avoid excessive burden on the server, please kindly avoid downloading the files frequently. The downloaded files are saved under the raw_data folder or the specified directory.

    # Download data for 2020 and 2021
    jpinfect_get_confirmed(years = c(2020, 2021), type = "sex")

    # Download English data for weeks 1 to 5 in 2025
    jpinfect_get_bullet(year = 2025, week = 1:5, dest_dir = "raw_data")

### Data Import

The acquired raw data into your local computer can be imported into R using `jpinfect_read_confirmed` and `jpinfect_read_bullet`.

    # Read a single file
    dataset2021 <- jpinfect_read_confirmed(path = "2021_Syu_01_1.xlsx")

    # Read all files in a directory
    place_dataset <- jpinfect_read_confirmed(path = "raw_data", type = "place")

    # Read provisional data
    bullet <- jpinfect_read_bullet(directory = "raw_data")

## Important Notes

- Data accuracy depends on the original source
- Data is provided by the Japan Institute for Health Security (JIHS)
- Usage is subject to the Government Standard Terms of Use (v1.0)
- This library is independently developed and is not affiliated with any government entity

## Reporting Bugs

If you encounter any bugs or issues while using the `jpinfect` package, please report them on the GitHub Issues page. When reporting, please include the following information:

- A clear description of the problem

- Steps to reproduce the issue

- Your R version and operating system

- Relevant error messages

- Example code to reproduce the problem