Description Usage Arguments Value Examples
Returns index of last occurence: Each row is scanned for the last column in which a certain integer is shown. Consider the following example: one row has the values 1-2-2-1-0-4, last occurence of 0 would be the fith column, last occurence of 1 would be the forth column, and so on.
1 | LastOccur(x, y)
|
x |
Dataframe or matix containing one sequence per row |
y |
The value of interest |
returns a vector containing the index of the last event occurence for every row.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Example 1: Small artificial data
my.data<-matrix(c(1,0,1,1,
0,0,1,0,
1,0,0,0,
0,0,0,1),4,4, TRUE) # create data
my.data # inspect sampe data
LastOccur(my.data,1) # last Occurence of one
LastOccur(my.data,0) # last Occurence of zero
# Example 2: Real data
data(CouplesCope)
LastOccur(CouplesCope[,2:49],1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.