clusterLongData3d {kml3d} | R Documentation |
~ Function: clusterLongData3d (or cld3d) ~
Description
clusterLongData3d
(or cld3d
in short) is the constructor
for ClusterLongData3d
object.
Usage
clusterLongData3d(traj, idAll, time, timeInData, varNames, maxNA)
cld3d(traj, idAll, time, timeInData, varNames, maxNA)
Arguments
traj |
|
idAll |
|
time |
|
timeInData |
|
varNames |
|
maxNA |
|
Details
clusterLongData3d
construct a object of class
ClusterLongData
. Two cases can be distinguised:
traj
is anarray
: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 labelledi1
,i2
,i3
,...If
timeInData
is missing, all the column are used (1:ncol(traj)
).- If
traj
is adata.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, iftimeInData=list(V=c(2,3,4),W=c(6,8,12))
, then the first variable-trajectory is 'V', its mesearment are in column 2,3 and 4. The second variable-trajectory is 'W', its measurment are in column 6,8 and 12.If
idAll
is missing, the first column of thedata.frame
is used.
Value
An object of class ClusterLongData3d
.
Examples
###############
### Building an array
tr1n <- array(c(1,2,NA, 1,4,NA, 6,1,8, 10,NA,2, 3,NA,NA,
4,NA,5, 6,3,4, 3,4,4, 4,NA,NA, 5,5,4),
dim=c(3,5,2))
###############
### clusterLongData
### With maxNA=3
clusterLongData3d(traj=tr1n,
idAll=as.character(c(100,102,104)),
time=c(1,2,4,8,16),
varNames=c("P","A"),
maxNA=3
)
### With maxNA=2
### Individual 104 is exclude
clusterLongData3d(traj=tr1n,
idAll=as.character(c(100,102,104)),
time=c(1,2,4,8,16),
varNames=c("P","A"),
maxNA=2
)