~ Function: longData3d ~
longData3d(traj, idAll, time, timeInData,varNames,maxNA)
traj |
|
idAll |
|
time |
|
timeInData |
|
varNames |
|
maxNA |
|
longData3d construct a object of class
LongData. Two cases can be distinguised:
traj is an array: the first dimension (line) are
individual. The second dimension (column) are time at which the
measurement are made. The third dimension are the differents
variable-trajectories. For example, traj[,,2] is the second variable-trajectory.
If idAll is missing, the individuals are labelled i1,
i2, i3,...
If timeInData is missing, all the column
are used (1:ncol(traj)).
traj is a data.frame: lines are individual. Time of
measurement and variables should be provide through
timeInData. timeInData is a list.
The label of the list are the
variable-trajectories names. Elements of the list are the column
containning the trajectories. For example, if
timeInData=list(V=c(2,3,4),W=c(6,8,12)), then the first
variable-trajectory is 'V', its measurement are in column 2,3 and
4. The second variable-trajectory is 'W', its measurement are in column
6,8 and 12.
If idAll is missing, the first column of the data.frame
is used.
An object of class LongData.
Christophe Genolini
1. UMR U1027, INSERM, Université Paul Sabatier / Toulouse III / France
2. CeRSME, EA 2931, UFR STAPS, Université de Paris Ouest-Nanterre-La Défense / Nanterre / France
[1] C. Genolini and B. Falissard
"KmL: k-means for longitudinal data"
Computational Statistics, vol 25(2), pp 317-328, 2010
[2] C. Genolini and B. Falissard
"KmL: A package to cluster longitudinal data"
Computer Methods and Programs in Biomedicine, 104, pp e112-121, 2011
#################
### From array
mat <- array(c(1,NA,3,2,3,6,1,8,10,1,NA,1,2,NA,3,2,3,2),dim=c(3,3,2))
longData3d(mat)
(ld1 <- longData3d(mat,varNames=c("Hyp","Col"),idAll=c("i101","i104","i105")))
plotTrajMeans3d(ld1)
#################
### From data.frame
dn <- data.frame(id=1:3,v1=c(2,2,1),t1=c(20,21,22),v1=c(3,2,2),t2=c(23,20,28),t3=c(25,24,29))
longData3d(dn,timeInData=list(c(2,4),c(3,5)),varNames=c("V","T"))
(ld3 <- longData3d(dn,timeInData=list(V=c(2,4,NA),T=c(3,5,6))))
plotTrajMeans3d(ld3)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.