Description Usage Arguments Details Value Author References See Also Examples
longData
is a constructor for the class LongData
.
It create object LongData
containing a single variable-trajectory.
For creating joint variable-trajectories, see longData3d
.
1 |
traj |
|
idAll |
|
time |
|
timeInData |
|
varNames |
|
maxNA |
|
longData
construct a object of class LongData
.
Two cases can be distinguised:
traj
is an array
:lines are individual. Column are time of measurment.
If idAll
is missing, the individuals are labelled i1
,
i2
, i3
,...
If timeInData
is missing, all the column
are used (timeInData=1:ncol(traj)
).
traj
is a data.frame
:lines are individual. Column are time of measurement.
If idAll
is missing, then the first column of the
data.frame
is used for idAll
If timeInData
is missing and idAll
is missing, then
all the columns but the first are used for timeInData
(the
first is omited since it is already used for idAll
): idAll=traj[,1],timeInData=2:ncol(traj)
.
If timeInData
is missing but idAll
is not missing,
then all the column including the first are used for timeInData
: timeInData=1:ncol(traj)
.
An object of class LongData
.
Christophe Genolini
1. UMR U1027, INSERM, Universit<e9> Paul Sabatier / Toulouse III / France
2. CeRSME, EA 2931, UFR STAPS, Universit<e9> de Paris Ouest-Nanterre-La D<e9>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
LongData
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #####################
### From matrix
### Small data
mat <- matrix(c(1,NA,3,2,3,6,1,8,10),3,3,dimnames=list(c(101,102,104),c("T2","T4","T8")))
longData(mat)
(ld1 <- longData(traj=mat,idAll=as.character(c(101,102,104)),time=c(2,4,8),varNames="V"))
plotTrajMeans(ld1)
### Big data
mat <- matrix(runif(1051*325),1051,325)
(ld2 <- longData(traj=mat,idAll=paste("I-",1:1051,sep=""),time=(1:325)+0.5,varNames="Random"))
####################
### From data.frame
dn <- data.frame(id=1:3,v1=c(NA,2,1),v2=c(NA,1,0),v3=c(3,2,2),v4=c(4,2,NA))
### Basic
longData(dn)
### Selecting some times
(ld3 <- longData(dn,timeInData=c(1,2,4),varNames=c("Hyp")))
### Excluding trajectories with more than 1 NA
(ld3 <- longData(dn,maxNA=1))
|
Loading required package: clv
Loading required package: cluster
Loading required package: class
Loading required package: rgl
Loading required package: misc3d
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE
3: .onUnload failed in unloadNamespace() for 'rgl', details:
call: fun(...)
error: object 'rgl_quit' not found
~~~ Class: LongData ~~~
~ idAll = [3] i1 i2 i3
~ idFewNA = [3] i1 i2 i3
~ varNames = [1] V
~ time = [3] 1 2 3
~ maxNA = [1] 1
~ reverse = [2x1]
- mean = 0
- SD = 1
~ traj = [3x3] (limited to 5x10) :
t1 t2 t3
i1 1 2 1
i2 NA 3 8
i3 3 6 10
~~~ Class: LongData ~~~
~ idAll = [3] 101 102 104
~ idFewNA = [3] 101 102 104
~ varNames = [1] V
~ time = [3] 2 4 8
~ maxNA = [1] 1
~ reverse = [2x1]
- mean = 0
- SD = 1
~ traj = [3x3] (limited to 5x10) :
t2 t4 t8
101 1 2 1
102 NA 3 8
104 3 6 10
~~~ Class: LongData ~~~
~ idAll = [1051] I-1 I-2 I-3 I-4 I-5 I-6 I-7 I-8 I-9 I-10 ...
~ idFewNA = [1051] I-1 I-2 I-3 I-4 I-5 I-6 I-7 I-8 I-9 I-10 ...
~ varNames = [1] Random
~ time = [325] 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 ...
~ maxNA = [1] 323
~ reverse = [2x1]
- mean = 0
- SD = 1
~ traj = [1051x325] (limited to 5x10) :
t1.5 t2.5 t3.5 t4.5 t5.5 t6.5 t7.5
I-1 0.2536549 0.4169251 0.8484769 0.53857747 0.4649484 0.6191658 0.4741615
I-2 0.1580030 0.8663529 0.9251745 0.69558285 0.9591778 0.1809721 0.7664597
I-3 0.4478898 0.3432202 0.8715614 0.99633298 0.7401479 0.6355737 0.7884460
I-4 0.8868185 0.6592330 0.2436893 0.03239554 0.6405315 0.3333683 0.7891820
I-5 0.3556629 0.7864370 0.5518707 0.86365655 0.8480387 0.4059756 0.8824011
t8.5 t9.5 t10.5 more
I-1 0.88749570 0.7228408 0.7820662 ...
I-2 0.92629566 0.6663656 0.2244521 ...
I-3 0.26339342 0.6219066 0.2467696 ...
I-4 0.40630504 0.2575018 0.7740903 ...
I-5 0.05947894 0.6836010 0.1007761 ...
... ...
~~~ Class: LongData ~~~
~ idAll = [3] 1 2 3
~ idFewNA = [3] 1 2 3
~ varNames = [1] V
~ time = [4] 1 2 3 4
~ maxNA = [1] 2
~ reverse = [2x1]
- mean = 0
- SD = 1
~ traj = [3x4] (limited to 5x10) :
t1 t2 t3 t4
1 NA NA 3 4
2 2 1 2 2
3 1 0 2 NA
~~~ Class: LongData ~~~
~ idAll = [3] 1 2 3
~ idFewNA = [3] 1 2 3
~ varNames = [1] Hyp
~ time = [3] 1 2 3
~ maxNA = [1] 1
~ reverse = [2x1]
- mean = 0
- SD = 1
~ traj = [3x3] (limited to 5x10) :
t1 t2 t3
1 1 NA 3
2 2 2 2
3 3 1 2
~~~ Class: LongData ~~~
~ idAll = [3] 1 2 3
~ idFewNA = [2] 2 3
~ varNames = [1] V
~ time = [4] 1 2 3 4
~ maxNA = [1] 1
~ reverse = [2x1]
- mean = 0
- SD = 1
~ traj = [2x4] (limited to 5x10) :
t1 t2 t3 t4
2 2 1 2 2
3 1 0 2 NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.