breed: Jitters Coe (and others) objects

View source: R/cl-farming.R

breedR Documentation

Jitters Coe (and others) objects

Description

This methods applies column-wise on the coe of any Coe object but relies on a function that can be used on any matrix. It simply uses rnorm with the mean and sd calculated for every column (or row). For a Coe object, on every colum, randomly generates coefficients values centered on the mean of the column, and with a sd equals to it standard deviates multiplied by rate.

Usage

breed(x, ...)

## Default S3 method:
breed(x, fac, margin = 2, size, rate = 1, ...)

## S3 method for class 'Coe'
breed(x, fac, size, rate = 1, ...)

Arguments

x

the object to permute

...

useless here

fac

a column, a formula or a column id from ⁠$fac⁠

margin

numeric whether 1 or 2 (rows or columns)

size

numeric the required size for the final object, same size by default

rate

numeric the number of sd for rnorm, 1 by default.

Value

a Coe object of same class

See Also

Other farming: perm()

Examples

m <- matrix(1:12, nrow=3)
breed(m, margin=2, size=4)
breed(m, margin=1, size=10)

bot.f <- efourier(bot, 12)
bot.m <- breed(bot.f, size=80)
bot.m %>% PCA %>% plot

# breed fac wise
# bot.f %>%  breed(~type, size=50) %>% PCA %>% plot(~type)

MomX/Momocs documentation built on Nov. 18, 2023, 10:53 p.m.