The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Package {jpstat}


Type: Package
Title: Tools for Easy Use of the 'e-Stat' API
Version: 0.5.0
Description: Provides tools to use the 'e-Stat' API (https://www.e-stat.go.jp/), the portal site for Japanese government statistics.
License: MIT + file LICENSE
URL: https://github.com/UchidaMizuki/jpstat, https://uchidamizuki.github.io/jpstat/
BugReports: https://github.com/UchidaMizuki/jpstat/issues
Encoding: UTF-8
Suggests: keyring (≥ 1.2.0), knitr, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
Imports: dplyr (≥ 0.8.0), pillar, purrr (≥ 1.0.0), rlang (≥ 0.3.0), stringr (≥ 1.3.0), tibble (≥ 1.3.1), tidyr (≥ 1.0.0), vctrs, navigatr (≥ 0.2.0), lifecycle, stickyr (≥ 0.1.3), httr2, cli
Depends: R (≥ 4.1.0)
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-07-20 23:24:27 UTC; uchid
Author: Mizuki Uchida [aut, cre]
Maintainer: Mizuki Uchida <uchidamizuki@vivaldi.net>
Repository: CRAN
Date/Publication: 2026-07-20 23:40:02 UTC

Tools for easy use of 'e-Stat' API

Description

logo

Provides tools to use the 'e-Stat' API (https://www.e-stat.go.jp/), the portal site for Japanese government statistics.

Author(s)

Maintainer: Mizuki Uchida uchidamizuki@vivaldi.net

Authors:

See Also

Useful links:


Collect data from an 'e-Stat' table

Description

collect() downloads the statistical values selected from an estat object with dplyr::filter(), dplyr::select(), and navigatr::rekey(), and returns them as a tidy tibble. Large tables are paginated automatically.

Usage

## S3 method for class 'estat'
collect(x, n = "n", names_sep = "_", query = list(), limit = 100000L, ...)

## S3 method for class 'tbl_estat'
collect(x, ...)

Arguments

x

An estat or tbl_estat object.

n

Name of the column that holds the observed values.

names_sep

Separator used to combine a classification's key (e.g. "area") with its selected columns (e.g. "name") into new column names (e.g. "area_name").

query

A list of additional queries passed to 'e-Stat's getStatsData API.

limit

Maximum number of records requested per page. 'e-Stat' caps this at 100000.

...

Ignored.

Value

A tibble.

Examples

## Not run: 
Sys.setenv(ESTAT_API_KEY = "Your API key")
estat("https://www.e-stat.go.jp/dbview?sid=0003433219") |>
  dplyr::collect()

## End(Not run)


Access 'e-Stat' data

Description

The estat() gets the meta-information of a statistical table by using getMetaInfo of the 'e-Stat' API, and returns an estat object that allows editing of meta-information by dplyr::filter() and dplyr::select().

Usage

estat(
  statsDataId,
  lang = c("J", "E"),
  query = list(),
  path = "rest/3.0/app/json"
)

Arguments

statsDataId

A statistical data ID on 'e-Stat'.

lang

A language, Japanese ("J") or English ("E").

query

A list of additional queries.

path

An e-Stat API path.

Value

A estat object.

See Also

https://www.e-stat.go.jp

https://www.e-stat.go.jp/en

Examples

## Not run: 
Sys.setenv(ESTAT_API_KEY = "Your API key")
estat("https://www.e-stat.go.jp/dbview?sid=0003433219")

## End(Not run)


Get table information for 'e-Stat' data (defunct)

Description

[Defunct]

Usage

estat_table_info(x)

Arguments

x

A estat object.

Details

estat_table_info() has been removed. Use summary() instead.

Value

This function always errors.


Objects exported from other packages

Description

These objects are imported from other packages. Follow the links below to see their documentation.

navigatr

activate(), deactivate(), itemise(), itemize(), rekey(), rekey_with()


Access 'RESAS' data (defunct)

Description

[Defunct]

Usage

resas(...)

Arguments

...

Ignored.

Details

The 'RESAS' API (https://opendata.resas-portal.go.jp/) was discontinued on 2025-03-24, and accounts as well as API keys were deleted. Therefore resas() no longer works and has been made defunct.

As an alternative for prefectural and municipal data, consider the MLIT Data Platform (DPF) GraphQL API (https://www.mlit-data.jp/).

Value

This function always errors.


Summarize the table information of an 'e-Stat' table

Description

summary() returns the table-level metadata (title, survey date, publisher, and so on) of an estat object created by estat().

Usage

## S3 method for class 'estat'
summary(object, ...)

## S3 method for class 'tbl_estat'
summary(object, ...)

Arguments

object

An estat or tbl_estat object.

...

Ignored.

Value

A tibble of table information.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.