R/stlab-set.R

## ====================================
## Function to set the state labels
## of a sequence object
## ==================================== 

"stlab<-" <- function(seqdata, value) {

	if (!inherits(seqdata,"stslist")) 
		stop("data is not a sequence object, see seqdef function to create one")

	nbstate <- length(alphabet(seqdata))
	
	if (length(value)!=nbstate) 
		stop("number of labels must be",nbstate)
	else
		attr(seqdata,"labels") <- value

	seqdata
} 

Try the TraMineR package in your browser

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

TraMineR documentation built on Sept. 19, 2023, 1:07 a.m.