long: Convert a 'wide' to 'long' format

View source: R/convert.r

longR Documentation

Convert a 'wide' to 'long' format

Description

Convert A panel, 'wide' format matrix or dataframe to a 'long' format data frame.

Usage

long(Y)

Arguments

Y

A panel, 'wide' format matrix or data frame. The columns have to represent different periods of time and the rows different entries (countries, regions, people, companies, etc.).

Value

The 'long' format data frame, with three columns: 'time', 'id' and 'value'.

See Also

Other convert: df2mat(), fac2num(), mat2df()

Examples

Y <- df2mat(dfPolicyRate)
Yl = long(Y)
head(Yl)


benjaminpeeters/BePe documentation built on July 7, 2022, 5:45 p.m.