Transpose a vector to a long formSource:
Many vectors (indicators, multipliers) are create in the wide form to conform matrixes in analytical functions. For printing it is more useful to have them in long form.
vector_transpose_longer( data_table, names_to = "nace_r2", values_to = "value", key_column_name = NULL, .keep = FALSE ) vector_transpose( data_table, names_to = "nace_r2", values_to = "value", key_column_name = NULL, .keep = FALSE )
A matrix or vector that normally has a key column.
The name of the first column. Defaults to
NULLwhen it is not changed. It should usually match the key column of the matrix or vector you would like to join the new vector created with
Keep the indicator identifier column? Defaults to
A long form vector with a key column, and optionally the identifier of the indicator in the first column.
This is a wrapper around
pivot_longer so you do not necessarily need to
import or load the entire tidyr package.
vector_transpose_longer( data.frame(indicator = "my_inidcator", agriculture = 0.0123, manufacturing = 0.1436, trade = 0.0921) ) #> # A tibble: 3 × 2 #> nace_r2 value #> <chr> <dbl> #> 1 agriculture 0.0123 #> 2 manufacturing 0.144 #> 3 trade 0.0921