df.stack {YRmisc} | R Documentation |
Stack data frame by one classifier
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
df.stack(df,name)
Arguments
df |
: a data frame used to stack |
name |
: new variable names of the data frame |
Examples
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"))
[Package YRmisc version 0.1.6 Index]