Compartment: Compartment

CompartmentR Documentation

Compartment

Description

Compartment is an R6 class for objects that represent the units of an outer tree simulation, such as a host individual or deme.

Methods

Public methods


Method new()

Usage
Compartment$new(
  name = NA,
  type = NA,
  source = NA,
  branching.time = NA,
  sampling.time = NA,
  unsampled = FALSE,
  lineages = list()
)

Method copy()

Usage
Compartment$copy(deep = FALSE)

Method get.name()

Usage
Compartment$get.name()

Method get.type()

Usage
Compartment$get.type()

Method get.source()

Usage
Compartment$get.source()

Method get.branching.time()

Usage
Compartment$get.branching.time()

Method get.sampling.time()

Usage
Compartment$get.sampling.time()

Method set.type()

Usage
Compartment$set.type(new.type)

Method set.source()

Usage
Compartment$set.source(new.source)

Method set.branching.time()

Usage
Compartment$set.branching.time(new.branching.time)

Method set.sampling.time()

Usage
Compartment$set.sampling.time()

Method set.unsampled()

Usage
Compartment$set.unsampled(is.unsampled)

Method is.unsampled()

Usage
Compartment$is.unsampled()

Method get.lineages()

Usage
Compartment$get.lineages()

Method add.lineage()

Usage
Compartment$add.lineage(new.lineage)

Method remove.lineage()

Usage
Compartment$remove.lineage(ex.lineage)

Method clone()

The objects of this class are cloneable with this method.

Usage
Compartment$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# load Compartments from a YAML object
path <- system.file('extdata', 'SI.yaml', package='twt')
settings <- yaml.load_file(path)
mod <- MODEL$new(settings)

# display first Compartment object
host1 <- mod$get.compartments()[[1]]
host1

# manually initialize a new Compartment object
hostN <- Compartment$new(name='newHost', unsampled=TRUE)
hostN$set.type(host1$get.type())


PoonLab/twt documentation built on Nov. 7, 2024, 4:18 a.m.