Learn R Programming

glinvci (version 1.2.4)

clone_model: Clone a GLInv model

Description

The clone_model function is a S3 generic method for either the glinv or glinv_gauss class.

Usage

clone_model(mod, ...)

# S3 method for glinv_gauss clone_model(mod, ...)

# S3 method for glinv clone_model(mod, ...)

Value

A new model that is a clone of mod.

Arguments

mod

An object of either glinv or glinv_gauss class.

...

Further arguments to be passed to the S3 methods. Not used currently.

Details

Because glinv or glinv_gauss object is mutable, the assignment model2 = model1 will not make a copy your model. The correct way to copy a model is to use the clone_model function.

Examples

Run this code
repar = get_restricted_ou(H=NULL, theta=c(0,0), Sig='diag', lossmiss=NULL)
mod1 = glinv(tree    = ape::rtree(10),
             x0      = c(0,0),
             X       = NULL,
             repar   = repar)
mod2 = mod1
mod3 = clone_model(mod1)
traits = matrix(rnorm(20), 2, 10)
set_tips(mod1, traits)
print(has_tipvals(mod1))  # TRUE
print(has_tipvals(mod2))  # TRUE
print(has_tipvals(mod3))  # FALSE

Run the code above in your browser using DataLab