makeSeries: Builds a list of list from a vector and a factor

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Builds an object of class list of lists, from two columns, of a data.frame. The first one contains the succession of codes to use, the second is a factor adequate to split the series into separate bouts.

Usage

1
makeSeries(x, fac)

Arguments

x

character vector: the record of item codes under study

fac

factor: a factor, of same length as x, indicating how to split the sequences into separate bouts.

Details

Suppose we observe the succession a,c,d,a,a,f on the subject A and b,d,f,e,c,c,a,d on the subject B. This can be coded as the concatenation
x: a,c,d,a,a,f,b,d,f,e,c,c,a,d
fac: A,A,A,A,A,A,B,B,B,B,B,B,B,B

fac indicating that the 6 first itms were successively emitted by A and the 8 following by B. See example.

Value

a list of lists, one per level of the factor fac

Author(s)

Jean-Sebastien Pierre

See Also

read.old.seq, read.series.seq,compseq

Examples

1
2
3
4
5
6
ser=sample(letters[1:6],100,replace=TRUE)
fact=as.factor(c(rep("one",30),rep("two",20),rep("three",10),rep("four",40)))
print(rbind(ser,fact)) # Facultative to see the structure
seq=makeSeries(ser,fact)
print(seq)
compseq(seq) # Facultative, compares the sequences obtained.

sequence documentation built on March 26, 2020, 7:30 p.m.