#################
### Simple data.frame
df <- data.frame(id=11:12,Va1=c(1,4),Va2=c(2,5))
as.longData(df)
#################
### Complexe data.frame
df <- data.frame(id=11:12,Va1=c(1,4),To1=c(0.1,0.4),Va2=c(2,5),To2=c(0.1,0.3))
### Transformation in a LongData, selecting variable "Va"
as.longData(df,timeCol=c(2,4))
### Transformation in a LongData, selecting variable "To"
as.longData(df,timeCol=c(3,5))
### Changing the id's name
as.longData(df,id=c("Ind-1","Ind-2"),timeCol=c(2,4))
### Changing the real time and the variable name.
as.longData(df,timeCol=c(3,5,2,4),timeReal=c(1,2,4,8),varName="Size")
#################
### matrix
mat <- matrix(1:8,2,dimnames=list(c("I1","I2"),c("Size1.2","Size1.5","Size2.5","Size4")))
as.longData(mat)
as.longData(mat,timeReal=c(1.2,1.5,2.5,4))
as.longData(mat,timeReal=c(1.2,2.5,4),timeCol=c(1,3,4),varName="Size")
Run the code above in your browser using DataLab