pmpp (version 0.1.0)

pmpp_data: Transform a single variable in the matrix format into the long panel format

Description

This function transforms a matrix of data with cross-sectional and time dimensions in rows and columns or columns and rows into a panel-structured, 3-column data frame

Usage

pmpp_data(indata, t_dim = "cols", var_name = "Y")

Arguments

indata

matrix with a single variable

t_dim

character string, one of: 'cols', 'rows'; whether time dimension in indata is across columns or rows

var_name

character string; name of the variable in indata

Value

A data.frame with 3 columns: unit, time and variable's values.

Examples

Run this code
# NOT RUN {
set.seed(1)
matrix_var <- matrix(rnorm(100), nrow = 20)
panel_var <- pmpp_data(matrix_var)
# }

Run the code above in your browser using DataLab