Learn R Programming

phylosim (version 3.0.5)

setStates.Sequence: Set the states for a set of Site objects aggregated by a Sequence object

Description

Set the states for a set of Site objects aggregated by a Sequence object. The value vector is recycled, which is useful when creating repeated patterns.

Usage

# S3 method for Sequence
setStates(this, value, index, ...)

Arguments

this

A Sequence object.

value

A character vector containg the states (recycled if shorter than the index vector). The states must be compatible with the corresponding Alphabet object.

index

An integer vector specifying a set of positions. It is set to 1:seq$length if omitted.

...

Not used.

Value

The Sequence object (invisible).

See Also

For more information see Sequence.

Examples

Run this code
# NOT RUN {
	# create a sequence object of length 10
	s<-Sequence(alphabets=list(NucleotideAlphabet()),length=10)
	# set the states in some ranges
	setStates(s,c("A","T","A"),index=1:5)
	setStates(s,c("G","C"),index=6:10)
	# display sequence
	s
	# set the states for the whole Sequence object
	setStates(s,c("A","T","T","A"))
	s
	# set states via virtual field
	s$states<-c("A","T")
	s
 
# }

Run the code above in your browser using DataLab