df.stack: Stack data frame by one classifier

Description Usage Arguments Examples

View source: R/df.stack.R

Description

Stack data frame by one classifier. This function takes the first column as a ordering variable. Then it take the variables names and repeat as the second column. The last column will be data under each variable name. This function is created to enable easier investigation with apply functions.

Usage

1

Arguments

df

: a data frame used to stack

name

: new variable names of the data frame

Examples

1
2
3
4
5
6
df <- data.frame(matrix(nrow=100,ncol=100))
for(i in 1:100){
 df[,i] <- rep(runif(1,1,100),100)
}
dim(df)
hdf <- df.stack(df,c("date","tkr","price"))

YRmisc documentation built on March 25, 2020, 5:13 p.m.

Related to df.stack in YRmisc...