io_tidy_wiot: Tidy data from the World Input Output Database

View source: R/io_tidy_wiot.R

io_tidy_wiotR Documentation

Tidy data from the World Input Output Database

Description

Converts raw WIOT table(s) from the 2016 release of the World Input Output Database, usually obtained by a call to io_load_wiot, into a long format tibble, i.e. a 'tidy' data frame.

Usage

io_tidy_wiot(wiot)

Arguments

wiot

A data.frame containing a raw WIOT for one or many years.

Value

Returns one tibble with the WIOT tables converted to a long format

See Also

io_load_wiot for (down)loading WIOT tables

Examples

## Not run: 

library(iotr)

# set cache_dir for WIOD to avoid long download times on every run !!!
cache_dir <- NULL

wiot_raw <- io_load_wiot(cache_dir, years = 2000:2014)

wiot_long <- io_tidy_wiot(wiot_raw)

# get wiot into standard long IO-table format
iot <- dplyr::filter(wiot_long, Country != "TOT", Year == "2014")
iot <-
  dplyr::select(iot,
                origin = Country,
                sector = RNr,
                destination,
                use,
                flow)

iot <- io_rm_negative_vad(iot, category_to_scale = 57)

iot <-
  io_rm_dynamics(iot,
                 dynamic_categories = c(60, 61),
                 category_to_scale = 57)

iot <- io_gen_own_trade(iot, max_replace = 1e-6)


## End(Not run)

okrebs/iotr documentation built on Dec. 12, 2024, 6:20 p.m.