Learn R Programming

phylosim (version 3.0.5)

setAlphabets.Sequence: Assotiate Alphabet objects to a set of Site objects aggregated by a Sequence object

Description

Assotiate Alphabet objects to a set of Site objects aggregated by a Sequence object.

Usage

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

Arguments

this

A Sequence object.

value

A list of Alphabet objects, recycled if shorter than the index vector.

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
	s<-Sequence(length=10)
	# set the alphabets for range 1:5
	setAlphabets(s,list(NucleotideAlphabet(),BinaryAlphabet()),1:5)
	# set the alphabets for range 6:10
	setAlphabets(s,list(AminoAcidAlphabet()),6:10)
	# get the list of attached Alphabet objects
	getAlphabets(s)
	# get Alphabets from a range
	getAlphabets(s,c(2:3,5))
	# set alphabets via virtual field
	s$alphabets<-list(BinaryAlphabet(),NucleotideAlphabet())
	# get alphabets via virtual field
	s$alphabets
 
# }

Run the code above in your browser using DataLab