`cast_variable()` converts data.tables to arrays and recursively processes nested lists.

cast_variable(
  x,
  variable_order = c("country", "origin", "destination", "sector", "input", "output")
)

Arguments

x

Data.table to be reshaped into vector/matrix/array with named dimensions if it is indeed a data.frame (i.e. data.table)

variable_order

A character vector specifying the desired order of the variables (columns) before casting. Defaults to country x origin x destination x sector x input x output.

Value

Vector/matrix/array