View source: R/clusterLongData3d.r
| clusterLongData3d | R Documentation |
clusterLongData3d (or cld3d in short) is the constructor
for ClusterLongData3d object.
clusterLongData3d(traj, idAll, time, timeInData, varNames, maxNA)
cld3d(traj, idAll, time, timeInData, varNames, maxNA)
traj |
|
idAll |
|
time |
|
timeInData |
|
varNames |
|
maxNA |
|
clusterLongData3d construct a object of class
ClusterLongData (from package kml). 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 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 the data.frame
is used.
An object of class ClusterLongData3d.
###############
### 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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.