buildMulti: Convert to a multinomial frame

View source: R/buildMulti.R

buildMultiR Documentation

Convert to a multinomial frame

Description

Assign multiple numbers to multiple columns containing the number of offspring. Copy information by the number of times equal to the number of offspring.

Usage

buildMulti(dat, copy, multi)

Arguments

dat

Data frame to convert.

copy

Column numbers to copy.

multi

A list containing the numbers to assign and matching column names, e.g. list(c(2,0,1),c("two","zero","one")).

Details

Replicate-level data should be converted to the individual-level to not underestimate phenotypic variance, which can influence genetic and maternal estimates (see Puurtinen et al. 2009).

Value

A converted data frame with a number of row matching the total number of individuals.

References

Puurtinen M, Ketola T, Kotiaho JS. 2009. The good-genes and compatible-genes benefits of mate choice. The American Naturalist 174(5): 741-752. DOI: 10.1086/606024

See Also

buildBinary

Examples

data(chinook_survival)
chinook_survival$total<- chinook_survival$alive + chinook_survival$dead #create total column
chinook_survival3<- buildMulti(dat=chinook_survival,copy=c(1:6,9),multi=list(c(2,1,0),
c("total","alive","dead")))

fullfact documentation built on May 29, 2024, 1:21 a.m.