NEWS
econiodatajp 0.1.3
- Fixed several
region_class = "pref" (2015) source downloads: Tochigi's URL pointed at Ibaraki's own workbook (wrong prefecture entirely), Kumamoto's URL pointed at the 2020 table instead of 2015, and Miyagi's, Kanagawa's, Shiga's, Yamaguchi's, Nagasaki's, and Nara's URLs had gone stale and 404'd.
- Added
io_margin_available, listing which region_type/region_class/year/region/sector_class/margin_type/language combinations have trade margin/transport margin data available via io_margin_get()/io_margin_target().
- Added
io_margin_get()/io_margin_target()/io_margin_target_raw(), for fetching the trade margin ("商業マージン表") and transport margin ("国内貨物運賃表", i.e. domestic freight) tables published alongside a region_type = "regional", region_class = "nation" producer-price benchmark table for year = 2011/2015. Each records, for every commodity, how much of its buyer-price markup over the producer price is trade margin versus transport margin. Takes the same region_type/region_class/year/region/language arguments as io_table_get()/io_table_target(), plus a required margin_type ("trade_margin" or "transport_margin") and a required sector_class (only "medium" exists as of writing, matching the granularity e-stat actually published these two tables at, but the argument isn't hardcoded to it). Not available from year = 2020 on, since e-stat stopped publishing these as standalone tables that year, folding the same information into the "input-output table" ("投入産出表") instead.
- Added
io_sector_available, listing which region_type/region_class/year/region/axis/language combinations have sector classification/conversion/JSIC-correspondence data available via io_sector_get()/io_sector_conversion_get()/io_sector_jsic_get().
- Added
io_sector_conversion_get()/io_sector_conversion_target()/io_sector_conversion_target_raw(), for fetching the sector classification tier crosswalk ("basic" to "small"/"medium"/"large"/"template") that io_table_get() reclassifies a table's "basic" sector classification from internally. io_sector_conversion_get() takes a required axis argument ("input"/"output", no default, like io_sector_get()), a region argument (matching io_table_get()'s, defaulting to NULL/"nation"), and a language argument ("ja"/"en", default "ja"). As for io_table_get()/io_table_target(), all three select a prebuilt archive, so io_sector_conversion_target()/io_sector_conversion_target_raw() take the same arguments (including language) and yield the same shape.
- Added
io_sector_get()/io_sector_target()/io_sector_target_raw(), for fetching a table's sector classification (sector names and types per classification tier) that io_table_get()'s tables are built from. Replaces the removed io_sector_regional_nation(). io_sector_get() takes a required axis argument ("input" or "output", no default, since the two axes return different sector sets -- endogenous plus gross-value-added sectors vs endogenous plus final-demand sectors, with different "basic"-tier codes on each), a region argument (matching io_table_get()'s, defaulting to NULL/"nation"), and a language argument ("ja"/"en", default "ja"). As for io_table_get()/io_table_target(), all three select a prebuilt archive, so io_sector_target()/io_sector_target_raw() take the same arguments (including language) and yield the same shape.
- Added
io_sector_jsic_get()/io_sector_jsic_target()/io_sector_jsic_target_raw(), for fetching the official crosswalk between a table's basic-classification industry sectors and the Japan Standard Industrial Classification (JSIC), currently available for region_type = "regional", region_class = "nation", year = 2011/2015/2020. Takes region and language arguments like io_sector_get()/io_sector_conversion_get() (language selects a prebuilt archive; only sector_name differs between "ja" and "en", since JSIC names and notes have no English source); unlike them, axis only ever accepts "output" (axis = "input" errors) since the source only ever publishes this correspondence keyed to the output/industry axis's basic-classification codes (#19). io_sector_jsic_get()'s result also carries a jsic_revision_year column, since JSIC has been revised multiple times and the jsic_code/jsic_name a given benchmark year's correspondence uses aren't comparable across a revision boundary (2011's correspondence uses the 2007 revision; 2015's and 2020's use the 2013 revision).
io_sector_available's type column values now exactly match the accessor they back ("sector" for io_sector_get(), "sector_conversion" for io_sector_conversion_get(), "sector_jsic" for io_sector_jsic_get()) instead of a shorter, arbitrary label (previously "conversion"/"jsic"); this is a breaking change for any code matching on io_sector_available$type's old values. axis is now "output", not NA, for type = "sector_jsic", since that's a known, fixed fact about the data (not a real absence) the same way region always resolves to a real value rather than NA. The sector_jsic_* tarchive target name now carries an explicit _output suffix (e.g. sector_jsic_nation_output_ja, not sector_jsic_nation) to match, letting io_sector_parse_name_archive() reuse the same sector_<prefix><region>_<axis>_<language> naming scheme as sector/sector_conversion instead of a separate axis-less branch. This only affects internal tarchive target names and io_sector_available's type/axis columns, not io_sector_get()/io_sector_conversion_get()/io_sector_jsic_get()'s own arguments.
io_sector_available's columns are reordered to add region and language (matching io_table_available's: region_type, region_class, year, region, type, axis, language, name), and every sector_*/sector_conversion_*/sector_jsic_* tarchive target name now carries explicit region and _ja/_en segments (e.g. sector_nation_input_ja, sector_conversion_nation_input_en, sector_jsic_nation_output_ja) instead of leaving the whole-country/Japanese case unmarked, mirroring io_table_name_archive(). Each _ja/_en pair is split from a bilingual intermediate target that stays in the pipeline manifest but not in io_sector_available. This only affects internal tarchive target names and io_sector_available's columns, not io_sector_get()/io_sector_conversion_get()/io_sector_jsic_get()'s own arguments (though io_sector_target()/io_sector_conversion_target()/io_sector_jsic_target() gain a language argument to match their *_get() counterparts).
- Tarchive target names now lead with
region (e.g. iotable_01_hokkaido_105_producer_price_competitive_import_ja, or iotable_nation_medium_producer_price_competitive_import_ja for a table whose scope is the whole country) instead of trailing it or omitting it, matching io_table_get()'s own argument order (region before sector_class); io_table_available()'s columns are reordered to match (region_type, region_class, year, region, sector_class, price_type, import_type, language, name). This only affects internal tarchive target names and io_table_available()'s column order, not io_table_get()/io_table_target()'s own arguments.
io_table_available() now also lists region_class = "pref", region_type = "regional" tables (one row per prefecture), previously omitted because their target names didn't match the naming scheme it introspects.
io_table_available() is now io_table_available, a tibble shipped as package data rather than a function -- introspecting every tarchive pipeline was too slow to redo on every call, including from inside a _targets.R pipeline (e.g. tarchetypes::tar_eval(..., values = io_table_available)), which re-sources on every run. This is a breaking change: drop the (). The shipped data is checked against a live recomputation by a test, so it can't silently go stale.
io_table_get()/io_table_target()/io_table_target_raw()'s year argument now comes before region, matching the unified region_type-region_class-year tarchive pipeline naming scheme every pipeline now follows (previously region_type = "multiregional" pipelines had an extra -nation- segment, e.g. iotable-multiregional-pref-nation-2011, now iotable-multiregional-pref-2011). This is a breaking change for any positional (unnamed) call.
io_table_get()/io_table_target()/io_table_target_raw()'s competitive_import (a logical) has been replaced by import_type ("competitive_import" or "noncompetitive_import"), matching the string-enum style of price_type/sector_class/language and io_table_available()'s other columns (its own competitive_import column is renamed to import_type and is now a character column, not logical). Every tarchive target also always carries an explicit _competitive_import/_noncompetitive_import marker in its name (e.g. iotable_nation_medium_producer_price_competitive_import_ja), matching the always-explicit _ja/_en language suffix, instead of leaving competitive-import as an unmarked, implicit default. This is a breaking change: replace competitive_import = TRUE/FALSE with import_type = "competitive_import"/"noncompetitive_import".
io_table_get()/io_table_target()'s region no longer accepts a numeric prefecture code (e.g. 1) as a shorthand for the code_name fragment (e.g. "01_hokkaido") -- only the exact code_name fragment used in the archive is accepted now. The numeric-code-to-name lookup this shorthand needed is deferred to a future jpcity-based resolver rather than kept as a stopgap in this package.
io_table_get()/io_table_target()'s region now defaults to "nation" internally rather than being left absent -- every table covers some region, and "the whole nation as a single scope" is itself a region, not an absence of one. region_class = "pref"/"block" under region_type = "multiregional" also resolve to "nation" now, since their prefecture/block breakdown is region_class detail, not a different region scope. io_table_available's region column is never NA as a result -- it's "nation" for every table except a region_class = "pref", region_type = "regional" one, where it's a real per-prefecture code_name fragment. region still isn't required for these tables (NULL, the default, is still accepted).
io_table_get()/io_table_target()'s sector_class for region_class = "pref" and "block" tables is now each table's actual official sector count (e.g. "105" for Hokkaido's own table, "26"/"31" for the 2005/2011 interregional table) instead of a "small"/"medium"/"large" label borrowed from the national table's classification tiers, which don't exist for these tables and pointed in a misleading direction (e.g. Hokkaido's old "medium" label had fewer sectors than some other prefectures' old "small").
io_table_get()/io_table_target() now suggest the closest valid pipeline or archive name (via tarchives::tar_check_archive_pipeline()/tar_check_archive_name()) when an invalid region_type/region_class/year/sector_class combination is requested, instead of only listing every valid choice.
io_table_get()/io_table_available now also cover region_class = "pref", year = 2020 tables for 41 of the 47 prefectures. Each prefecture publishes its own table on its own schedule with its own sector classification, so its sector count and column layout usually differ from that prefecture's 2015 table; Akita, Nara, Tottori, Tokushima, Kochi, and Oita haven't published a 2020-basis table as of this release and remain 2015-only (#26).
io_table_get()/io_table_target()'s region_type = "regional", region_class = "nation", year = 2020 producer-price table (and every sector_class/language variant derived from it) was under-scaled by 1000x: the source workbook is denominated in 10-oku-yen, unlike the 2011/2015 tables' 100-man-yen, but value_scale hadn't been updated to match.
io_table_get()/io_table_target()'s price_type = "purchaser_price" (already a documented argument value, but never backed by data) now works for region_type = "regional", region_class = "nation", year = 2011/2015, at sector_class = "medium"/"large"/"template" (no "basic"/"small", since e-stat only publishes its purchaser-price table, "購入者価格評価表", from the integrated medium classification up). It's read from that table's "medium" workbook and reclassified to "large"/"template". The workbook's trailing "商業マージン" (trade margin) and "貨物運賃" (transport margin) columns aren't carried into the result: they only reconcile each row's purchaser-price total back to its domestic output, and have no counterpart in econio's sector types. Use io_margin_get() for the trade margin/transport margin breakdown.