Type: | Package |
Title: | R Interface to e-Stat API |
Version: | 0.4.0 |
Description: | Provides an interface to e-Stat API, the one-stop service for official statistics of the Japanese government. |
URL: | https://yutannihilation.github.io/estatapi/ |
BugReports: | https://github.com/yutannihilation/estatapi/issues |
License: | MIT + file LICENSE |
LazyData: | TRUE |
Depends: | R (≥ 3.3) |
Imports: | httr, purrr (≥ 0.2), readr (≥ 0.2), dplyr (≥ 0.5.0), tibble, rlang |
RoxygenNote: | 7.1.0 |
Suggests: | testthat, keyring |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2020-04-12 06:03:19 UTC; yutani |
Author: | Hiroaki Yutani |
Maintainer: | Hiroaki Yutani <yutani.ini@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2020-04-12 06:20:02 UTC |
R Interface to e-Stat API
Description
Provides an interface to e-Stat API, the one-stop service for official statistics of the Japanese government.
Author(s)
Maintainer: Hiroaki Yutani yutani.ini@gmail.com (ORCID)
See Also
http://www.e-stat.go.jp/SG1/estat/eStatTopPortalE.do
Util
Description
Util
Usage
ESTAT_API_URL
Format
An object of class character
of length 1.
e-Stat API
Description
Get Statistical Something From e-Stat API
Usage
estat_api(path, appId, ...)
Arguments
path |
API endpoint. |
appId |
Application ID. |
... |
Other parameters. |
getDataCatalog API
Description
Get information about the statistical dataset files and databases via e-Stat API.
Usage
estat_getDataCatalog(
appId,
lang = c("J", "E"),
.use_label = TRUE,
surveyYears = NULL,
openYears = NULL,
statsField = NULL,
statsCode = NULL,
searchWord = NULL,
dataType = NULL,
catalogId = NULL,
resourceId = NULL,
startPosition = NULL,
limit = NULL,
updatedDate = NULL,
...
)
Arguments
appId |
Application ID. |
lang |
Language of the data. |
.use_label |
Whether to take the human-redable label value or the code value when
flattening a field containing both (default: |
surveyYears |
Year and month when the survey was conducted. The format is either
|
openYears |
Year and month when the survey result was opened. The format is the
same as |
statsField |
Field of statistics. The format is either two digits(large classification) or four digits (small classification). For the detail of the classification, see http://www.soumu.go.jp/toukei_toukatsu/index/seido/sangyo/26index.htm. |
statsCode |
Code assigned for each statistical agency and statistics. The format can be five digits (agency), and eight digits (statistics). For the detail, see http://www.stat.go.jp/info/guide/public/code/code.htm. |
searchWord |
Keyword for searching. You can use |
dataType |
Type of data. |
catalogId |
Catalog ID. |
resourceId |
Catalog resource ID. |
startPosition |
Index of the first record to get. |
limit |
Max number of records to get. |
updatedDate |
Last updated date. The format is either |
... |
Other parameters. |
See Also
http://www.e-stat.go.jp/api/e-stat-manual3-0/#api_2_6 http://www.e-stat.go.jp/api/e-stat-manual3-0/#api_3_7
Examples
## Not run:
estat_getDataCatalog(
appId = "XXXX",
searchWord = "CD",
dataType = "XLS",
limit = 3
)
## End(Not run)
getMetaInfo API
Description
Get meta-information about the statistical dataset via e-Stat API.
Usage
estat_getMetaInfo(appId, statsDataId, lang = c("J", "E"), ...)
Arguments
appId |
Application ID. |
statsDataId |
ID of the statistical dataset. |
lang |
Language of data. |
... |
Other parameters. |
See Also
http://www.e-stat.go.jp/api/e-stat-manual3-0/#api_2_2 http://www.e-stat.go.jp/api/e-stat-manual3-0/#api_3_3
Examples
## Not run:
estat_getMetaInfo(appId = "XXXX", statsDataId = "0003065345")
## End(Not run)
getStatsData API
Description
Get some statistical data via e-Stat API.
Usage
estat_getStatsData(
appId,
statsDataId,
startPosition = NULL,
limit = NULL,
lang = c("J", "E"),
.fetch_all = TRUE,
...
)
Arguments
appId |
Application ID. |
statsDataId |
ID of the statistical dataset. |
startPosition |
Index of the first record to get. |
limit |
Max number of records to get. |
lang |
Language of the data. |
.fetch_all |
Whether to fetch all records when the number of records is larger than 100,000. |
... |
Other parameters.
|
See Also
http://www.e-stat.go.jp/api/e-stat-manual3-0/#api_2_3 http://www.e-stat.go.jp/api/e-stat-manual3-0/#api_3_4
Examples
## Not run:
# fetch all data, which may take time
estat_getStatsData(
appId = "XXXX",
statsDataId = "0003065345"
)
# fetch data up to 10 records
estat_getStatsData(
appId = "XXXX",
statsDataId = "0003065345",
limit = 10
)
# fetch data up to 100,000 records (max number of records available at once)
estat_getStatsData(
appId = "XXXX",
statsDataId = "0003065345",
.fetch_all = FALSE
)
# fetch all data in the specifed category
estat_getStatsData(
appId = "XXXX",
statsDataId = "0003065345",
cdCat01 = c("008", "009", "010")
)
## End(Not run)
getStatsList API
Description
Search for statistical datasets via e-Stat API.
Usage
estat_getStatsList(
appId,
searchWord,
lang = c("J", "E"),
.use_label = TRUE,
surveyYears = NULL,
openYears = NULL,
statsField = NULL,
statsCode = NULL,
searchKind = NULL,
collectArea = NULL,
startPosition = NULL,
limit = NULL,
updatedDate = NULL,
...
)
Arguments
appId |
Application ID. |
searchWord |
Keyword for searching. You can use |
lang |
Language of the data. |
.use_label |
Whether to take the human-redable label value or the code value when
flattening a field containing both (default: |
surveyYears |
Year and month when the survey was conducted. The format is either
|
openYears |
Year and month when the survey result was opened. The format is the
same as |
statsField |
Field of statistics. The format is either two digits(large classification) or four digits (small classification). For the detail of the classification, see http://www.soumu.go.jp/toukei_toukatsu/index/seido/sangyo/26index.htm. |
statsCode |
Code assigned for each statistical agency and statistics. The format can be five digits (agency), and eight digits (statistics). For the detail, see http://www.stat.go.jp/info/guide/public/code/code.htm. |
searchKind |
Type of statistics.
|
collectArea |
Area of statistics.
|
startPosition |
Index of the first record to get. |
limit |
Max number of records to get. |
updatedDate |
Last updated date. The format is either |
... |
Other parameters. |
See Also
http://www.e-stat.go.jp/api/e-stat-manual3-0/#api_2_1 http://www.e-stat.go.jp/api/e-stat-manual3-0/#api_3_2
Examples
## Not run:
estat_getStatsList(
appId = "XXXX",
searchWord = "CD",
limit = 3
)
## End(Not run)