vector_transpose_wider {iotables} | R Documentation |
Transpose a vector to wider format
Description
Many vectors (indicators, multipliers) are create in the wide form to conform matrixes in analytical functions. For binding it is more useful to have them in wide format.
Usage
vector_transpose_wider(
data_table,
names_from,
values_from,
key_column_name = NULL,
key_column_values = NULL
)
Arguments
data_table |
A matrix or vector that normally has a key column. If the key column must be created
or replaced, used |
names_from , values_from |
A pair of arguments describing which column (or columns) to get the name of the output column ('names_from'), and which column (or columns) to get the cell values from ('values_from'). |
key_column_name |
The name of the key column. |
key_column_values |
You can explicitly supply key column values. Defaults to |
Details
This is a wrapper around pivot_wider
so you do not necessarily need to
import or load the entire tidyr package.
See Also
Other iotables processing functions:
conforming_vector_create()
,
household_column_get()
,
iotable_year_get()
,
key_column_create()
,
matrix_round()
,
output_get()
,
primary_input_get()
,
rows_add()
,
supplementary_add()
,
total_tax_add()
,
vector_transpose_longer()
Examples
vector_transpose_wider (data_table = germany_airpol[, -2],
names_from = 'induse',
values_from = 'value')
vector_transpose_wider (data_table = germany_airpol[1:8, 3:4],
names_from = 'induse',
values_from = 'value',
key_column_values = "CO2_emission" )