Learn R Programming

poppr (version 1.1.5)

setpop: Manipulate the population factor of genclone objects.

Description

The following methods allow the user to quickly change the population of a genclone object.

Usage

setpop(x, formula = NULL)

setpop(x) <- value

Arguments

x
a genclone object
formula
a nested formula indicating the order of the population hierarchy.
value
same as formula

Examples

Run this code
data(Aeut)
Aeut.gc <- as.genclone(Aeut)

# Notice that there are two hierarchical levels, Pop and Subpop
Aeut.gc

# Currently set on just Pop
head(pop(Aeut.gc))

# setting the hierarchy to both Pop and Subpop
setpop(Aeut.gc) <- ~Pop/Subpop
head(pop(Aeut.gc))

# Can be used to create objects as well.
Aeut.old <- setpop(Aeut.gc, ~Pop)
head(pop(Aeut.old))

Run the code above in your browser using DataLab