Returns a sorting vector to sort state sequences in a TraMineR sequence object (`seqdef`

) by the states at the successive positions.

1 2 3 |

`seqdata` |
A state sequence object as returned by |

`start` |
Where to start the sort. One of |

`sort.index` |
Should the function return sort indexes? If |

With `start = "end"`

(default), the primary sort key is the final state, then the previous one and so on. With `start = "beg"`

, the primary sort key is the state at the first position, then at the next one and so on.

With `sort.index = FALSE`

, the function returns a vector of values whose order will determine the wanted order. This should be used as `sortv`

argument of the `seqiplot`

function. With `sort.index = TRUE`

, the function returns a vector of indexes to be used for indexing.

The `sortv`

form is an alias for `sorti(..., sort.index = FALSE)`

.

If `sort.index = FALSE`

, the vector of sorting values.

Otherwise the vector of sorting indexes.

Gilbert Ritschard

Details about `type = "i"`

or `type = "I"`

in
`seqplot`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
data(actcal)
actcal.seq <- seqdef(actcal[1:100,13:24])
par(mfrow=c(1,2))
seqIplot(actcal.seq, sortv=sortv(actcal.seq), withlegend = FALSE)
seqIplot(actcal.seq, sortv=sortv(actcal.seq, start="beg"), withlegend = FALSE)
actcal.seq[sorti(actcal.seq)[90:100],]
data(mvad)
mvad.seq <- seqdef(mvad[1:100,17:86])
par(mfrow=c(1,2))
seqIplot(mvad.seq, sortv=sortv(mvad.seq, start="end"), withlegend = FALSE)
seqIplot(mvad.seq, sortv=sortv(mvad.seq, start="beg"), withlegend = FALSE)
print( mvad.seq[sorti(mvad.seq,start="beg")[90:100],], format="SPS")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.