Learn R Programming

phylosim (version 3.0.5)

setAlphabet.Site: Attach an Alphabet object to a Site object

Description

Attach an Alphabet object to a Site object. If the ancestral site is not NA, then the symbol set of the ancestral Alphabet object and the new Alphabet object must be the same. The current state must be in the symbol set of the new Alphabet object, unless it is NA.

Usage

# S3 method for Site
setAlphabet(this, new.alphabet, ...)

Arguments

this

A Site object.

new.alphabet

A valid Alphabet object.

...

Not used.

Value

Returns the new Alphabet object (invisible).

See Also

For more information see Site.

Examples

Run this code
# NOT RUN {
	# create a site object
	s<-Site()
	# create an Alphabet object
	a<-Alphabet(c("A","T","G"))
	# attach alphabet to site object
	setAlphabet(s,a)
	# set site state
	s$state<-"A"
	# clone the alphabet object
	b<-clone(a)
	# modify symbol set in b
	b$symbols<-c(b$symbols,"C")
	# attach b to s via virtual field
	s$alphabet<-b
	s$alphabet
 
# }

Run the code above in your browser using DataLab