Learn R Programming

iotables (version 0.4.7)

vector_transpose: Transpose a vector

Description

Many vectors (indicators, multipliers) are create in the wide form to confom matrixes in analytical functions. For printing it is more useful to have them in long form.

Usage

vector_transpose(
  data_table,
  names_to = "nace_r2",
  values_to = "value",
  .keep = FALSE
)

Arguments

data_table

A matrix or vector that should have a key column.

names_to

Defaults to 'nace_r2'.

values_to

Defaults to 'value'.

.keep

Keep the indicator identifier column? Defaults to FALSE.

Value

A long form vector with a key column, and optionally the identifier of the indicator in the first column.

Details

This is a wrapper around pivot_longer so you do not necessarily need to import or load the entire tidyr package.

Examples

Run this code
# NOT RUN {
vector_transpose (
  data.frame(indicator = "my_inidcator", 
             agriculture = 0.0123,
             manufacturing = 0.1436,
             trade = 0.0921)
)
# }

Run the code above in your browser using DataLab