NumbOccur: NumbOccur

Description Usage Arguments Value Examples

Description

Returns the Number of occurences for sequences with different lenghts. Outside the context of sequence analysis this means that for each frequency of one specifics integer will be computed.

Usage

1
NumbOccur(x, y, t = NA, prop = TRUE)

Arguments

x

Dataframe or matix containing one sequence per row

y

single integer: represents the occurence that should be counted

t

optional vector that contains the lengths of sequences

prop

if TRUE: proportion will be computed,if FALSE: sum will be computed

Value

returns a vector containing containing the number of occurences.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Example 1: Small artificial example

# Creating data, if sequence ends, rest should be 'NA'
seq1<-c(1,0,0,0,1,0,1, NA, NA, NA) # 3 out of 7 Entrys should be round about .43
seq2<-c(1,1,1,1, NA, NA, NA, NA, NA, NA) # 4 out of 4 should be 1
seq3<-c(1,0,0,0,1,1, NA, NA, NA, NA) # 3 out of 6 should be .50
my.data<-rbind(seq1,seq2,seq3)

# Determine the proportion of ones in my.data
NumbOccur(my.data,1)
NumbOccur(my.data,1, prop=FALSE) # compute absolute frequencies


# Example 2: Real data dyadic sequences
# A researcher is interested in how often was a certain behavior
# shown till another one stopped completely

my.last<-LastOccur(CouplesCope[,2:49],1) # how long till stress ended?
NumbOccur(CouplesCope[,50:97],1, my.last) # how often did dyadic coping occure in this time?

PeFox/DySeq documentation built on May 8, 2019, 1:28 a.m.