R/alphabet.R

Defines functions alphabet

Documented in alphabet

## ============================================
## Retrieve the alphabet from a sequence object
## ============================================

alphabet <- function(seqdata, with.missing=FALSE) {

	if (inherits(seqdata,c("stslist","PSTf"))){
    statl <- attr(seqdata,"alphabet")
    if (isTRUE(with.missing)) statl <- c(statl, attr(seqdata,"nr"))
  }
  else if (inherits(seqdata,"seqelist")){
    statl <- levels(seqdata)
  }
  else {
		stop("seqdata should be a state sequence object, an event sequence object, or a suffix tree. Use seqdef or seqecreate.")
  }

return(statl)
}
	

Try the TraMineR package in your browser

Any scripts or data that you put into this service are public.

TraMineR documentation built on Jan. 9, 2024, 3:02 p.m.